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.

7 Rules for Writign URLs

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.