Underscores are so 90s

| | Comments (12)

Something unexpected I just learned: to many, it's now considered best-practice to use hyphens ( - ) instead of underscores ( _ ) when separating words in URLs. For example, instead of this:

http://example.com/fun_stuff/my_cats.html

You'd be better off doing this:

http://example.com/fun-stuff/my-cats.html

Why? Simple: Google recommends it. According to Matt Cutts, the big G will do a better job recognizing and indexing the words in your URL if you separate them with hyphens.

This has everything to do with search engine optimization (SEO), a term I tend to shy away from, what with its coming from the sinister realm of marketing versus the practical software architecture tack that I try to stick with. Sometimes the paths cross unexpectedly, though.

For me, this happened most recently as I set up a new Movable Type (4.23) instance for a client. I was surprised to find that, by default, it enforced that all files it created use dashes in their names instead of underscores. Googling on this topic led me to discussions from people asking how to get MT to use dashes in its filenames instead of underscores - the exact opposite of what I sought, but I was intrigued that so many should care. A little more searching led to this post on Google Inside, as well as the articles I linked to above.

I always approach the notion of work-pattern changes due to Google Fiat with a bit of skepticism, but this one's apparently settled into place globally over the last few years without my really noticing. Interesting, anyway.

12 Comments

Doug Orleans Author Profile Page said:

LiveJournal converts underscores in usernames to hyphens in URLs, but I thought that was a DNS thing (since each username gets a domain, e.g. foo-bar.livejournal.com). But maybe it's for Google too.

Also, I can type a hyphen on my Verizon phone, but not an underscore (as far as I can tell). (My G1 phone can do both, of course.)

I've always hated underscores, myself. Reminds me of the bad old days of K&R C programming. Scheme's custom is to have hyphens in symbol names, so that's how I tend to think. (And Scheme used to be case-independent, so you couldn't really do mixedCase. But I use that in Java and C++.)

Lee Stewart said:

I suppose using URLs like this is even worse: http://www.randomoddness.com/scripts/894/ (I'm hoping that my content "speaks for itself").

I've always liked underscores in variable names, camel_case annoys me. It's partially that I learned to program with it. But I also think it handles acronyms better (APILibrary versus api_library).

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.

Can anyone recommend a reputable mobile game developer. I own a web design company called ncube digital and we want to expand into this area of the market after recently losing a client because we could not provide this service. Please contact us if you are a experienced dev or can recommend one, thanks.

does anyone know a professional online game developer. I own a web design company called ncube digital and we want to expand into this area of the market after recently losing a client because we couldn't provide this service. Please email us if you are a developer or can recommend one, cheers.

Can anyone recommend a professional flash game developer. I own a web design company called ncube digital and we want to expand into this area of the market after recently losing a client due to not being able to provide this service. Please email us if you are a designer or can recommend one, many thanks.

Franklin said:

Directory submissions can help as long as they are done right. They are too time consuming for me to do so I use Directory Maximizer http://bit.ly/aA6bCt They hand submit and only use quality directories

I saw this really good post today.

Adella Chuba said:

A very interesting read and a great post alltogether. Would you mind if I posted the same article on my blog (with a reference to your website)?

A very interesting read and a great post alltogether. Would you mind if I posted the same article on my blog (with a reference to your website)?

Leave a comment