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 '16 at 18:42
  • The users can understand what is going on, but I need some way for the system to understand the URLs. – Matthew Brown aka Lord Matt Jul 22 '16 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 '16 at 20:52

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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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