The design decision was to automatically replace spaces with dash (-) when building URLs. This led to URLS such as example.com/user/john-smith. This was fine as long as names were "JohnSmith" and "Fred Bloggs".

Then comes "Freddy Double-Barrel" and we have a huge encoding headache. His URL is example.com/user/freddy-double-barrel which looks exactly like his name is "Freddy Double Barrel" (entirely the wrong string for looking this fellow up). So this user's profile is always 404 because there is no easy way to decode back again.

So how do I represent actual dashes when we are using dashes as spaces?

  • 2
    This is "only" the URL. Personally, I wouldn't worry about it - users will "get the idea", which is all that matters. The 100% correctly formatted name/phrase should be in the page itself from which the search engines will associate more "weight". That is, unless you are using this path segment to lookup this fellow (which is probably not a good idea anyway).
    – MrWhite
    Jul 22, 2016 at 18:42
  • The users can understand what is going on, but I need some way for the system to understand the URLs. Jul 22, 2016 at 19:02
  • 1
    What happens when you have two "John Smith"s? URLs are generally flattened strings in terms of the variation of characters used and there are many other special chars and accents etc. in peoples names that probably need to be flattened in order to create a friendly URL (see this question on SO) - this is only going to further aggravate the issue of reversing this "conversion" in order to look the fellow up.
    – MrWhite
    Jul 22, 2016 at 20:52

2 Answers 2


The URL does not need to contain such level of detail.

It is perfectly fine to have the url you propose: example.com/user/freddy-double-barrel for Freddy Double-Barrel.

From a SEO point of view, the url should cover two aspects:

  • be appealing to users
  • describe what the page is about

A url like example.com/user/freddy-double--barrel or example.com/user/freddy-double_barrel does not change anything, they even look a bit unnatural to me.

Most of the slugs generator strip special characters from the title to create a clean and readable url.

Consider the following example, this is the first result in Google for guillain-barre:

enter image description here

The webpage url is: http://www.mayoclinic.org/diseases-conditions/guillain-barre-syndrome/basics/definition/con-20025832 with guillain-barre-syndrome, but its title is: Guillain-Barre syndrome

enter image description here

As long as your page title, meta description and/or content properly says Freddy Double-Barrel, it is perfectly fine to keep the current slug scheme.

  • This is an excellent answer, and the example gives me the necessary certainty now! No need to translate a space different then a word-joining hyphen into a URL. Both translate into a hyphen. Hence you use the ability to trace back what it originally was. But as your example shows that does not hinder the search result. P.S.: This practice is somehow counter intuitive in terms of orthography and semantics, but hey a bunch of youngster programmer nerds made a decision at the end of the 1990ies and that stuck, and I will abide to it.
    – porg
    Jul 26, 2022 at 15:59
  • Is it ok to use single and double hyphens combined in the file name part of the URL? Wordpress has a flat hierarchy for media files. Having many files one will use prefixes for grouping. I'd like to use hyphens as normal word separators, and double hyphens to separate groupings. /project-alpha--subtopic-uno--differentiating-topics-in-this-image.jpg. Much easier to grasp for human eyes than the uniformly separated /project-alpha-subtopic-uno-the-differentiating-topics-of-this-image.jpg. It must not help SEO. It just should not harm it. Then, I'd prefer it (as producer and consumer).
    – porg
    Jul 26, 2022 at 16:09

I suggest you use underscore for space replacement and dash for dash so "Freddy Double-Barrel" becomes freddy_double-barrel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.