SEO - Search Engine Friendly Drupal

I am no SEO specialist... but I have seen the results of good design and bad, and I've been developing for the web for long enough to have a reasonable handle on how to design a site for pretty reasonable SEO.

Drupal, out of the box, is ok - but there are things you can do to vastly improve your chances of getting noticed when people search for what you have.

First of all, clean URLs.  You may have seen mention of them when installing Drupal.  If you didn't understand, then here is an example:

"Unclean" URLs = includes a 'index.php?q=' (This is 'out-of-the-box' Drupal)

http://essentialtech.co.nz/index.php?q=node/5

Clean URLs gets rid of the ugly bit

http://essentialtech.co.nz/node/5

To do this you need mod_rewrite installed for apache (details to come, but google it - its a common install), and some extra code in your virtual host configuration files... and switch on Clean URL's in Admin - Settings - Clean URL's

Here is an example of a virtual host configuration file that uses mod_rewrite to remove the ?q= part:

<VirtualHost * >
  ServerName    www.yourdomain.com
  ServerAlias   yourdomain.com
  ServerAdmin   webmaster@yourdomain.com
  DocumentRoot  /var/www/yourdomain/www
  ErrorLog      /var/www/yourdomain/logs/error_log
  CustomLog     /var/www/yourdomain/logs/access_log combined
  ScriptAlias   /cgi-bin/ /usr/lib/cgi-bin/

    <Directory "/usr/lib/cgi-bin">
      AllowOverride AuthConfig
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow From all
    </Directory>

    <Directory "/var/www/yourdomain/www/">
      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>

</VirtualHost>

But of course, this still isn't particularly friendly... who really knows what /node/5 means?  So what you should do at this point is make sure you have the 'Path' option in your Core - optional section of modules ticked.  This gives you an option to change the path name for each node and give it a meaningful name:

http://essentialtech.co.nz/contact_us

Ah, now it makes sense... and it will make more sense to Google as well (Yes, there are lots of search engines out there, but who really uses anything else if they really want the answer at the moment?  Lets face it, Bing is hopeless (although it will get better I am sure), and Yahoo is... well, I don't know anyone that uses it any more.

As an important side note, Pathauto can auto-generate names for nodes based on the title, and this is a godsend for sites where you create a lot of content and dn't want to have to manually edit the URL of each on.

There is a lot more to SEO, and I will extend this article in time, but nice sensible URLs are the first step, and an important one.  I'll add details about adding a sitemap next time.  Stay tuned.

virtual host configuration

virtual host configuration file that uses mod_rewrite to remove the ?q= part:

Thanks for sharing above code, it is really useful to me.

Drupal SEO is just gr8.....

The modules supplied by Drupal are just gr8, when it comes to SEO.
Modules like Pathauto, page title, nodewords, Global redirect, etc.  
Clean urls are an very imp feature of drupal, that output user-friendly urls. Thanks for the "mod_rewrite" trick as well.

 

Thanks & Regards,
Freelance website developer mumbai (Drupal)

You're welcome :)

You're welcome :)

Quite a good read, I always

Quite a good read, I always like informational pieces.

Great tips, thanks...

This is really useful... I wonder why its not just part of Drupal...

Hi Barry, actually it is.

Hi Barry, actually it is.  Drupal 6 will automatically use clean URLs if the server the site is running on supports it.  But the server needs to be configured to support it, and thats really what this article is about.  Cheers, Steve

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal6>, <html>, <java>, <javascript>, <php>, <python>. The supported tag styles are: <foo>, [foo], [[foo]].
  • Syntax highlight code surrounded by the <pre class="brush: lang">...</pre> tags, where lang is one of the following language brushes: bash, cpp, css, jscript, java, php, python.

More information about formatting options

CAPTCHA
This question is to prevent automated spam submissions. Upper or lower case does not matter. If you can't read it properly, just submit what you believe it says and if its wrong you will be presented with a new captcha image.
Image CAPTCHA
Enter the characters shown in the image.