Home > Drupal > Enabling Clean URL in Drupal

Enabling Clean URL in Drupal

After searching for about 3 days and trying all sorts of suggestions and modifications, i still could not get drupal to enable the Clean URL. Finally i had some luck with it and was able to make drupal obey my commands😀. I wrote this so that it will help save someone 3 to 4 days.

My System Configuration
Ubuntu Lucid Lynx 10.04 Desktop edition
Drupal 6
Apache 2
server localhost

I assume that your drupal is up and running.

1. First check your apache error logs for a mesage like this
File does not exist: /var/www/usr/
This means apache is trying to find the directory /usr under /var/www/ and i bet you wont have it there. Create a symbolic link to /usr under /var/www/
If it shows a different directory then you must find and see if that exists – if not create a symlink accordingly
Clear your apache log
Restart apache and check if this error message is showing up – it should not !

2. Next i assume
a) you have enabled the apache rewrite module (http://drupal.org/node/15365)
b) your apache config file (/etc/apache2/apache2.conf) has the following line in it AccessFileName .htaccess

3. The apache.conf file in my DRUPAL directory (/etc/drupal/6/apache.conf) has the following contents

Alias /drupal6 /usr/share/drupal6

<Directory /usr/share/drupal6/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all

If your drupal root is different from /usr/share/drupal6 change it above – you will also have to take care of the symbolic links i mentioned earlier to see where exactly you need to point it to
Make a note of what the Alias says here – that is what you must point your rewrite base to – Mine here says /drupal6

4. The final step is to change the ReWriteBase in the htaccess file in the DRUPAL directory (/etc/drupal/6/htaccess)
Initially mine was commented and read  #RewriteBase /drupal
There is one more below it for virtual root but as we are not dealing with that dont bother
By default the RewriteBase points to /var/www/
Change the first RewriteBase from /drupal to /drupal6 – dont forget to uncomment it (remove the # at the beginning)

5. Restart apache and go to the clean URL page – i am sure you will love what you see🙂

Categories: Drupal
  1. Rob M
    November 13, 2010 at 7:58 AM

    Thanks a lot for this, simple clear concise and it works

    • Sunthar
      December 5, 2010 at 8:58 PM

      It really did save me several days time. (I don’t even know how much, as I haven’t figured it out from where you found the solution!😉 )

      In my case drupal was in a different subdirectory so the rewriteBase tip helped. Without this, clean url was pointing to the actual directory (revealing the subdirectory during rewrite).

      Thanks a lot.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: