Use Dashes not Underscores in URLS for good SEO

I need not delve into the technical details of percent-encoding to make my point regarding keeping your URLs clean as part of your on-site search optimization, but some basic coaching is in order. I see a couple repeat offenses that bother me and I would like to discuss them here briefly in hopes of raising some awareness of the situation.

– Use Dashes in URL’s NOT spaces or underscores
– Don’t use any special characters in your urls. Only letters, numbers, and dashes.

First major offense is the use of an apostrophe in URLs

Feel free to use them in the title and throughout the content of your page but do not use them in the URL structure. Search engines view an apostrophe in a URL as %27. So Google sees’t-do-this as http://don%27t-do-this. This causes issues with keyword separation and can very well cause issues in your search rankings. Some sites also have problems dealing with encoded characters as well. For example and other URL shortening services have had issues properly linking to sites using apostrophes and other encoded characters in the URL.

If you use WordPress for your site and/or blog it ‘should’ automatically fix your URL for you after you type your post title as you can see in the image below. If it doesn’t, click the edit button and fix it before publishing.
WordPress Cleans Apostrophes from URLs

Second major offense is the use of spaces in URLs

I don’t see spaces used in URLs as often as I see apostrophes but it’s unfortunately still too common. Spaces cause a similar issue by displaying as %20. Hyphens are the preferred character for separating two words in URLs – do not use spaces or underscores. Don’t argue with me, there are many reasons for this, including the actual spec that explain it. This includes Matt Cutts from Google re-explaining the dashes-vs-underscores thing in this Google Webmaster Help Video.

Same goes for Filenames

While I’m at it, your filenames need to follow these same guidelines. You optimize your image and video filenames to include keywords (right? you should be!) and should be using hyphens to separate those keywords as you do in your URLs.

If you currently have these problems on your site – I don’t recommend editing your old URLs unless you’re prepared to create 301 redirects for all of them (301 underscores to hyphens). Do keep an eye on your new posts and be cognizant of the situation in the future and keep your URLs clean as part of your SEO strategy.

  • Paul Sutton

    Is there a way to further clean up the urls by removing the source filetypes (e.g. .htm, .php) with .htaccess? The current method I use requires listing all pages with the .php extension to be listed, which can get monotonous, not to mention, would require editing each time a new page was added.

    • Chuck Reynolds

      the extensions aren't so much of a big deal, but there is an easy way to remove them via htaccess mod_rewrite. Start with and you'll get the idea.
      It's not really a problem but if you're already doing it, using mod_rewrite will help you so you don't have to edit page urls anymore – probably save you a few milliseconds on the fly too ;)

      • Paul Sutton

        That's what I was thinking of, thanks. Just seems a bit nicer to be able to direct someone to rather than, not to mention avoiding the 301 redirect if the site ever gets built in another language.

      • @paulredmond

        The biggest issue in using the extension in a url design, is that you are exposing the server-side technology and application design to the end-user. You are also locking the url design to a specific language when it doesn't have to be.

  • Aaron Kavlie

    It's surprising how many sites still completely drop the ball on this one — big corprorate sites that ought to know better. Witness this from HP:

    Also, this (among other things) is a useful filter for the legitimacy of SEO operations — if they go on and on about keywords, directories, search engine submissions, etc. while not saying a word about your URL structure, they're not worth listening to.

    • Chuck Reynolds

      agreed. I highly doubt HP cares the slightest bit about their urls or any small technical aspect of on-site optimization like that. They're big enough and have so many inbound links they don't have to care – guys like us however and small biz need to squeeze every bit of optimization out of everything :)

      • thos003

        but doesn't HP's canonical cure this… From source code: <link rel="canonical" href=""&gt;

        • Chuck Reynolds

          Yes and No…. Google has only recently started to really handle those properly but nobody else really has – but in HP's defense, as I said they're big and don't need to worry about it as much, and the canonical links for them are probably the best they can do at this point to repair what has been done.

          Bing has was said to be working on the integration of canonical but they're more worried about combining their serps with yahoo's at this point. It'll happen but don't rely on canonical… Many other places that pull info and aggregate don't use it.

          It's good to have canonical tags in place but start with a good foundation of clean urls and site structure and you won't have to worry about IF some or all of the search engines are looking at your canonical tags

  • Darren Smith

    Fourth major offence – using apostrophes in plurals? (URL's) ;)

    • Chuck Reynolds

      hah… did that just to show another one dropped in the url but yeah i know you mean

  • James MacDonald

    Same great tips laid out nicely and clearly. Many people don't take into account how they name files such as photo's etc. and include those dreaded underscores. One thing seems to be clear – think and plan before you just go ahead and do something with your website.

  • ElizOF

    Thank you Chuck! I learned some great tips from this post. As a blogger with limited insight to SEO and HTML, I frequently make the mistakes you mentioned and probably others I am unaware of. I appreciate your clear explanations. Any other thoughts would be appreciated.

    • Chuck Reynolds

      Thanks for reading and commenting – I'm a pretty bad blogger but I do put out a lot of good quit tidbits on twitter very often if you're interested in that. (and yes I know I need to blog more lol)

  • vegasgeek

    Though it's not really a concern for SEO, it also bothers me when people use mixed-case when naming pages or files. Stick to all lower case file names and URLs!

    • Chuck Reynolds

      lol agreed… that bothers me too but at least it's not damaging their SEO potential; well as long as they have the proper separator between the camel-cased words :)

  • Andy @ FirstFound

    Excellent advice there, thanks. I'm sick of seeing URLs20%like20%this, when it could all be solved with a hyphen. Never mind the SEO potential, it means people don't remember your URLs, it looks ugly when people share links and it's just plain lazy.

  • Ric Dragon

    If you’re going to chop the extensions off file names, you’ll want to end them with trailing slashes. Most servers will do this by default- but you’ll want to write your urls that way in links, too. Positive from seo perspective.

    • Chuck Reynolds

      Agreed but most dynamic sites (like I am using wordpress as the example) don't use extensions. I think you meant to reply to the comment by Paul so I know what ya mean :)
      And yes trailing slashes are a good thing – and that's partially what canonical meta data is for too.
      Thx for the comment

  • marco

    Excellent advice – this is pretty basic stuff in seo these days and is the least that people should be doing. You also need to make sure that you use good titles for your pages and that the URLS that show when you search have good keywords in them as the page title URL is very important to the search engine spiders.

    Choose your keyword first and then work your page title around your keywords – if you use wordpress sites you can change your url settings quite easily so that they appear in a format of words not numbers etc and you need to make sure that your site has been designed in a way that the pages display the URL as words and not numbers such as CAT6 etc

    Anyway pretty basic stuff

    • Chuck Reynolds

      Indeed – perhaps that's another post I need to write, but wasn't the focus of this one :)

      Thanks for commenting Marco!

  • Mike Taylor

    Basic advice yes, but good solid advice too that I see a bunch of people still ignoring these days. I know I look back at some of the urls I created and just scratch my head wodnering what I was thinking when I came up with those.

  • EasyStreet

    I could have used some of this advice many years ago. We recently updated our URL structure and it has made a huge difference in our indexed pages, PR, etc. We still are trying to clean up all the duplicate content indexed with different session ID's and URL parameters we had used in the past. And our programmer loved to use _ all over our site. Hopefully using GWTs and a lot of canonicals we can get it cleaned up. Thanks for the post Chuck.

  • Mike from Indianapolis

    @vegasgeek I hear ya there? Mixing upper and lower case it annoying. It’s also, I heard, correlated with criminal tendencies. Of course, that could have more to do with lack of education than anything. When it comes to naming files, i like to stick with all lower case, and prefer hyphens to underscores. I can’t believe some people are using apostrophes in their URLs.

rynoweb powered by chuck, built on wordpress