Search engine friendly Drupal URL's

Date: Wed Dec 31 2008 Drupal
Drupal and Clean URL's described how to enable "Clean URL's" in Drupal. It's useful to know why you should enable Clean URL's.

Out of the box Drupal default URL format is:

example.com/?q=node/12345
.

While not terribly egregious this URL format is not helpful for search engine optimization. One rule of thumb in SEO is for the URL to contain words relevant to the article. The default URL of node/12345 is not relevant to the article.

A big mark against the "?q=" portion of the default Drupal URL is that it's the standard indicator of dynamic pages. Google has some webmaster guidelines and has this to say about '?' in URL's http://www.google.com/support/webmasters/bin/answer.py?answer=35769

If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.

I think the reason search engines prefer URL's containing words relevant to the URL is to enable the users to better understand what they might see or read when following a URL. Google concurs: http://www.google.com/support/webmasters/bin/answer.py?answer=76329&hl=en

Consider: http://davidherron.com/book-page/89-podcasting-overview-instructions-and-notes

Just by reading that URL you might get the idea it's about podcasting, right? That's what the search engines might be encouraging us to do, to make our URL's be useful to humans.

Another effect is that when someone pastes a bare URL into a content management system, the CMS often automatically turns that URL into


<a href="/davidherron.com/URL.html">URL</a>

This means the URL will become the text of its link. Another rule of thumb in SEO is to make the link text have keywords related to the article.

The first step to SEO-friendly Drupal URL's is to enable "Clean URL's". Drupal and Clean URL's covers how to do this, the effect is to remove the "?q=" portion of the default Drupal URL format.

Drupal has a built-in feature named "URL Aliases" that causes Drupal to do a different URL for a page. After enabling the URL Aliases module the node create/edit page will have a new section, URL path settings. However you have to a) remember to do this, b) manually concoct meaningful URL's, etc ..

The pathauto module makes this automatic. Drupal and Clean URL's also goes over installation of pathauto. The effect of pathauto is to take relevant values from the article, do a bit of URLization, convert those article-values into a URL, and install that as the URL Alias.