7 Rules for Writing URLs
The structure of a Web site’s URLs can have a dramatic impact on crawlability, SEO, and user-friendliness. A good SEO already knows how to craft effective URLs, but web developers, IT staff, and management may not understand why the web address matters. In this article, I’ll share a list of best practices for choosing URLs and explain why they matter.
But before the list begins, here’s the first rule of URL Club: Do not change your URLs unless they’re broken. If your web site is being crawled and indexed just fine by search engines, and/or if users are having no trouble clicking on your URLs despite them being long or ugly, don’t change things. The potential SEO boost is smaller than the potential risk that something will go wrong on your end, or on the search engines’ end. If you’re URLs are broken, however, here’s how to fix them.
How to Fix ‘Broken’ URLs
1. Keep URLs as short as possible.
Usability impact: According to several studies, people prefer short URLs. Searchers more likely to click a short URL. Google’s Maile Ohye wrote that a long URL “decreases [the] chances of [a] user selecting the listing” in the search engine result pages (SERPs). A Marketing Sherpa study confirms that users click more often on shorter URLs.
SEO impact: Weaker sites with few inbound links are unlikely to see spiders crawling deep content. Spiders may visit and revisit content closer to the root directory more often; these are pages with shorter URLs. Also, it stands to reason that other webmasters and bloggers will be more likely to link to pages with shorter URLs; as a publisher, I trust short URLs more than longer ones and tend to avoid linking to long URLs that I’m not sure will remain active forever.
2. Remove session IDs from URLs.
Crawlability impact: Spiders are less likely to crawl a URL with a session ID because there’s a strong likelihood the content is a copy of another URL. Long parameters can look like session IDS and should also be avoided.
3. Limit variables and parameters in URLs.
Crawlability impact: At conferences, Google’s Matt Cutts has said it’s best to limit the number of parameters in a URL to “2 or 3.” As described in the Google Webmaster Central article referenced above, URLs with too many parameters are likely candidates to be duplicates of other URLs, so spiders try to avoid crawling them.
Usability impact: As mentioned above, users prefer short URLs.
4. Use keywords in URLs.
SEO impact: Keywords in the URL help tell the spider what the page is about. A URL such as www.domain.com/green-widgets.html is obviously about green widgets, whereas a URL such as www.domain.com/product.php?ID=23476234 is not obviously about anything. Keywords in the URL are an additional signal to the spider.
Usability impact: As the Marketing Sherpa study (and many others, too) indicates, users prefer short, clear URLs that help them pre-determine what the page will be about before they click.
5. Use hyphens to separate keywords.
SEO impact: Spiders recognize hyphens as a space. Underscores and other symbols may not be recognized the same way. Matt Cutts recently explained in a video that hyphens are best when it comes to separating keywords.
Disclaimer: Don’t overdo it. A file name like electronic-green-widget-repair-store.html looks spammy and untrustworthy.
6. Fix your URL canonicalization.
To a search engine spider, www.domain.com and domain.com are not the same. Your web site should not be available at both addresses; choose one (the “canonical” domain) and use that 100% of the time. Make sure the secondary domain uses a 301 redirect to the primary domain.
BONUS TIP: Not sure which to choose, the www version or the non-www version? There are two main considerations:
1. Which domain gets the most inbound links?
2. Which domain would be easier to change on your own pages (i.e., internal links, references, etc.)?For example: If you have a lot of inbound links pointing to domain.com, and it would be easy to switch your internal links and references from www.domain.com to domain.com, that should be what you do.
SEO impact: Choosing a primary domain will help avoid duplicate content. It will also help focus your inbound link “juice.” If your home page is available at both domain.com and www.domain.com, chances are good that both URLs are getting linked to, and your home page is not getting the full benefit of all those inbound links.
7. If changing URLs, use 301 redirects to point from the old URL to its new version.
If you absolutely must change your URLs, you can minimize the impact by using a 301 redirect from each old URL to the specific new URL that matches. Don’t 301 all your old URLs to your new home page; that’s not spider-friendly or user-friendly.
SEO impact: By using a 301 redirect, you are telling the spiders that the old URL has been permanently replaced by the new URL. The impact of this is that all of the inbound link “juice” will be passed from the old URL to the new one, giving it a better chance at replacing the old URL in the SERPs more cleanly.
Usability impact: The 301 redirect will also help your human visitors reach the appropriate new URL immediately.
Word of Warning, Repeated
A complete change of URL structure should never be taken lightly. I advise clients not to change URLs unless they’re completely broken. You can expect to suffer a short-term loss of search engine visibility when you change your URLs, even when changing them to more SEO-friendly versions. In the long run, you should regain your visibility and even exceed it if your URL structure is improved correctly. There’s no way to estimate how long this might take.
URL Examples
Here’s a quick look at sample URLs using the best practices explained above.
Okay: http://www.domain.com/Shopping/Categories/Apparel_Clothing/
Better: http://www.domain.com/shopping/clothing.html
Best: http://www.domain.com/clothing/
Bad: http://www.domain.com/?cat=3423&pid=45345345&sessID=325646VGHD36523746&ref=56756
Okay: http://www.domain.com/?cat=3423&pid=45345345
Better: http://www.domain.com/shopping/clothing.html
Best: http://www.domain.com/clothing/
Your Turn
What rules would you add to this list? What are your thoughts on my rules for writing URLs? Comments are open.
I have ran into that situation many times where you get IT staff or marketing departments envolved in SEO and they cannot seem to understand why short keyword optimized URL’s make a difference.
Great post, I saw the same info on Matt Cutts blog about the hyphens, something I had always suspected but never really had confirmed from someone that works “behind the curtain” until Cutts came out and said it.
Changing URL structure is definitely not easy, ESPECIALLY if you use shared hosting. Changes in .htaccess can screw up other sites if you use the same server for lots of smaller sites (depending on the host)
I personally prefer domains without the www but some people insist on using it.
I thought I knew all of the information about URL’s but apparently not. The information is very useful. Performing your SEO properly can make all the difference in the world even though you don’t see it it really counts in the long run. I use to use underlines and not hyphens in my URL – not anymore.
I do agree with all the thing, but don’t you thing that categorizing the URL will return you benifit. In your example :
Okay: http://www.domain.com/Shopping/Categories/Apparel_Clothing/
Better: http://www.domain.com/shopping/clothing.html
Best: http://www.domain.com/clothing/
Ok, you have to remove the “categories” from the url because that does not make any sense. But what about a URL like:
http://www.domain.com/shopping/mens/clothing/jeans.html
Don’t you think it will give Google a better categorical view, plus more relavent keywords?
@Talal
It’s about reducing the parameters to focus on just the most important keywords.
Okay: http://www.domain.com/Shopping/Categories/Apparel_Clothing/
–Google doesn’t know whether to rank the URL better for “shopping” or for “categories” or for “apparel clothing”
Better: http://www.domain.com/shopping/clothing.html
–Google knows to rank for “clothing”, “shopping” and “shopping clothing” and other related searches, however, the keywords “shopping” and “clothing” won’t rank as well because the URL itself has both keywords equally weighed.
Best: http://www.domain.com/clothing/
–Google knows to rank for “clothing” because that’s all this is about, and due to the high focus, it knows it’s more relevant than the other URLs.
This is an oversimplified example, of course, but a URL that contains only the most important keywords is always seen as more relevant as long as it isn’t spam.
Thanks for the post. Now I realize how important it is to have short keyword-rich URLs.
I had no idea that hyphens counted as spaces. I’m going to have to rework all my urls to make sure that the keywords in them pick up right. Right now they’re all mashed together…
Another good post Matt. I didn’t know about those studies on long urls resulting in fewer clicks…
Excellent Information, many of my clients are always curious about writing urls, redirects and other things – this will be a great reference for them.
Awesome post. Adding this to bookmarks for sure. We always run into trouble explaining this to IT people. Thanks for putting together a solid resource on this subject!
Wow, thanks for all the great feedback on this, everyone.
@Talal — I think Tyler’s answer is really good and have nothing to add.
@Charlie — this was written with IT people in mind, so I hope it helps you, as well. 🙂
Thanks for the url basics. It cannot be written often enough, but many webmaster make mistakes and do not use rewriting.
Thank You – I have had issues trying explain why I didn’t put the word company in the URL I set up. I also had a bit of a a fight with not using the ampersand but I diligently explained that I really couldn’t because it was a special character not a regular one.
Many businesses think that the FULL name of the company (I.E. http://www.business_name_company_inc.com should be used. I often find myself trying to explain why using that in a URL makes it to lengthy. Your article will make it easier to do so.
You say that http://www.domain.com/clothing/ is best, but wouldn’t http://www.domain.com/clothing.html be better or alternatively http://www.domain.com/clothing – without the trailing slash (which seems to be quite popular for seo blogs nowadays)?
This way your content would be one level higher in your site structure and so gain importance in the eyes of the spiders.
Do you recommend never using page id #’s as a URL?
Such as:
http://www.domain.com/?page_id=18
You really shouldn’t do that, just look at the Google results for the keyword ‘mortgage’. As you can see, the first 20 results all have the term mortgage in the url (either as part of the domain name or page name). So you are really missing out when you use the page id and not a keyword rich page name.
Agreed with all rules but have one problem – I can’t find really good CMS with all of this futures! Can You suggest something?
Use of special characters link ä, ü, ø, å etc. in the url.
Was is your take on a url like /ferienhäuser/
or is /ferienh%C4%A4user/ better
or /ferienhaeuser/
should I use ä in the url, I can see Wikipedia use %C4%A4 for the ä
Hi Mikkel,
special characters are always a problem, because it depends on the client. Modern browsers, and crawlers like google have no problem, but the “ä” is interpret like “%C3%A4” in the url-encoding. Other encodings interprete this character different, so here begins the problem, because you are duplicating urls, so creating duplicate content. Having much work with redirecting 301 to your destination url with “ä”. But some clients produce errors, so 404 is a common scenario, if you are looking at your google webmaster account or server stats. Try to use a “a”. The outperformance you are looking for a specific term in german, like “ferienhäuser” in SEO, it is not so much regarding this problem. Why you do not use “ferienhaus”? This singular term is also the root keyword, and many people look for this keyword also.