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
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 </Directory>
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🙂