tags:

views:

793

answers:

6

When you are building URLs that should be legible for users and search engines and you do it automatically from the content, what's the best way to represent blank spaces? Hyphens (this is what StackOverflow uses)? Underscores? Any other? Does any of those make a different for SEO?

A: 

I think that depends on your favorite. My favourites are underscores, but I don't see any (dis-)advantages if using hyphens or other valid URL characters instead. And everything looks better than %20 :)

schnaader
+5  A: 

Again, personal preference - personally I think hyphens work better than underscores, because underscores can clash with the underlining a tags add (by default), so http://someurl.com/this_is_a_address looks like there are no underscores there. (as this is stack overflow, roll over the link). http://someurl.com/this-is-a-address looks fine.

Kazar
The underscores sit under the underline in FF3
ck
How odd, I'm running FF3 on ubuntu, and the underscores are obscured.
Kazar
Underscores are under the underline in Chrome
Charlie Somerville
Also under the underline in IE8! But I prefer the dashes.
Graham Clark
+18  A: 

Both are valid URL characters and both have their pros and cons.

Pro dash

  • Google recommends dashes, and here is what Matt Cutts from Google has to say about Dashes vs. underscores.

    If you have a url like word1-word2, that page can be returned for the searches word1, word2, and even “word1 word2″. That’s why I would always choose dashes instead of underscores.

  • Dashes seem to be what major blogs do: The Huffington Post, TechCrunch, Engadget, ...
  • Dashes seem to be what major CMS do.
    Not sure about that one anymore, can anyone comment?
  • As mentioned by Kazar, underscores can clash with the underlining of links.
  • I find underscores awkward to type.
  • Rene Saarsoo pointed out that dashes take less space than underscores in proportional fonts.
  • Ionut G. Stan mentioned that underscores are not allowed in hostnames. If you strive for consistency you should opt for dashes.

Pro underscore

  • Dashes are not allowed in ISO9660 file systems. This can be a problem if your content is also shipped on DVD or CD (e.g help files or eLearning content).
  • In some languages (e.g. German) dashes can be word characters and are not generally considered word separators.
Ludwig Weinzierl
A lot of CMSs allow you to choose. For example, I know that Drupal lets you specify explicity the path seperator. However, it is worth pointing out that the default they use is indeed dashes.EzPublish also defaults to dashes, I believe, but does let you choose.
Kazar
Dashes are usually used inside "joined words" (also in English, like "URL-friendly"). But they are rare enough and most of the time the meaning will not get lost when you have word-with-dash-inside-words-just-separated-with-dash.
Rene Saarsoo
+1  A: 

I'd say dashes. I used to use underscored for pretty much every such purpose (representing spaces) but nowadays, with all the visual thingies blinking all round, you often find underlining that makes them normally invisible.

ldigas
+3  A: 

You know, if you buy a domain name, you're allowed to use hyphens inside that name, but no underscores. This is an additional reason for which I believe hyphens are better than underscores.

Ionuț G. Stan
+5  A: 

Another advantage of dashes is that in proportional font they take less space that underscores. Compare:

It's not a lot, but every little helps :)

Rene Saarsoo
+1 This made me smile.
Nixuz
+1 me also. :) what a saving
metal-gear-solid