Drupal 6 Tutorial – SEO For URLs
Hello everyone, allow me to introduce myself, as this is my first tutorial (from many to come hopefully). My name is Alex Petrisor and I’m a Creative Advertising student. However, I also work as a freelance web developer in London.
Recently I’ve been working on an on-line store which was created in Drupal 6. As important as SEO might be for any site, for an on-line shop it’s crucial. I was pleased to see how well Drupal handles that, even out-of-the-box.
Well, enough of that, let’s jump in!
1Clean URLs
Enable Clean URLs – This should be already on, but just to make sure go to http://www.yoursite.com/admin/settings/clean-urls and make sure that it’s Enabled.
2The Path Module – Custom URL aliases
Enable the Path module – This is the module that allows you to rename your URLs. Enable it on your modules page at http://www.yoursite.com/admin/build/modules under Core – optional. You will now have the option to manually type in the URL for your nodes, on the node editing form at URL path settings. This will be a relative path to your domain. So if your domain is http://www.yoursite.com/ and you set the URL alias for the node Cookies as cookies, the full path of the node will be http://www.yoursite.com/cookies.
3The Token Module
Download and install the Token module here. You will probably need this for any Drupal installation, as it provides other modules with certain helpful text variables like the username, post title, taxonomy, etc. In our case it will help with the next module we will use, which is…
4The Pathauto Module – Automatic URL aliases
Download and install the Pathauto module here. This is highly recommended as it creates nice URLs automatically for you, whenever you create new content. It does that based on several things like title, taxonomy, content type, and username. To be honest this will work out-of-the-box, but in case you want a more granular control over the URL structure you can easily change that in the module’s settings. This is where the Token module comes in handy.
Let’s say that you wanted all your content of the type page to fall under the following path pattern: http://www.yoursite.com/pages/page-name. For that to happen you would need to go to the Node Path Settings under Pathauto, and under Pattern for all Page paths write pages/[title-raw] and hit Save configuration. The [title-raw] will automatically get replaced with an alias that reflects your current page’s title, thanks to Token. If you click on Replacement Patterns you will get a list of all the variables that you can use in your URLs.
5The Global Redirect Module
Download and install the Global Redirect module here. This module addresses one important SEO issue: canonicalization of your URLs. What that means is that it makes sure that for each piece of content you have, there is one URL and one URL only. These are some of the things it does:
- Removes trailing slashes from URLs (“/”)
- Permanently redirects any requests for content using the non-clean URL format
- Permanently redirects any requests that refer to the homepage, but use something other than the canonical URL for the homepage address.
- Permanently redirects any requests for content where the case of the requested URL does not match the case of the canonical URL.
This, as expected, won’t need much (if any) configuration either.
6Drupal Rewrite Rules – htaccess friendly url
Last, but not least, as the final step for URL SEO, you need to decide whether to use http://www.yoursite.com or http://yoursite.com. By default both work and point to the same place. That can confuse the spider so it’s best if you just use one of them. I tend to use the www version, but it’s entirely up to you.
So here’s how we do this: In your drupal 6 installation folder, you will find a file called .htaccess. You need to edit that file, so scroll down to
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the ‘www.’ prefix. Choose ONLY one option:
7Rejoice!
That’s right, you deserve it! And remember, keep your pages rich with meaningful content. There is not much point for optimization if there is nothing to optimize right?
Well, that’s about it for drupal SEO for now. I hope that you’ve enjoyed this tutorial, and if you have, you’ll be happy to hear that I will write a new one soon covering page titles, keywords, descriptions, sitemaps and some more juicy stuff.
Do you have anything to add to optimizing Drupal 6 URLs?
Glayds Holtsclaw
Well-written. Thanks. I have been learning a lot about content management lately. I have also been experimenting with setting up an e-commerce site using WordPress. Have you ever done that? Any suggestions for me? It’s pretty fun learning it. If you’d like to see my blog it’s here. Thanks again for this blog – it is really educational.
Alex
Thank you for the comment, Gladys. Unfortunately I haven’t tried building an e-commerce site with Wordpress so far. I might be wrong, but I think that Drupal is far superior to Wordpress when it comes to that functionality.