|
Fix 404 error when enabling Drupal clean urls
|
|
|
|
|
Contributed by Chad Brandt
|
|
|
|
Saturday, 24 January 2009
Some modules in drupal require the clean urls to be enabled. I have found some issues with this on my mac as well as any other deployment where the drupal site is not the root website. The error you will see is a 404 'The requested URL was not found on this server'. There is an easy solution to fix this and get clean urls working with drupal.
Take these steps to fix this issue
1. Make sure apache has mod_rewrite enabled. Make sure you have this line in your httpd.conf and that it is not commented out. The httpd.conf file can be found in /etc/apache2 on Mac OSX and in /etc/httpd/conf on most Linux distributions.
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
2. Make sure you website has permission set properly. On linux this will usually be in your httpd.conf file. On mac this will in in /etc/apache2/users/<username>.conf. The permissions should look like this
<Directory "/Users/cbrandt/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
3. Fix the RewriteBase in your .htaccess file in the root of your drupal install. The default .htaccess that comes with drupal is assuming that the wesite will be the root context (eg www.yourdomain.com) but if you install it in something like www.yourdomain.com/~user/drupal then you will need to fix the .htaccess file
- find the line that says #RewriteBase /drupal
- uncomment this and change it to your root context. So for my example I would have
RewriteBase /~user/drupal
Save this file and retry your clean urls.Powered by AkoComment 1.0 beta 2! |