I just installed a fresh copy of Drupal 6.19 to get to speed on how to write modules. But for some reason the rewrite module isn't working for Drupal.
What I have checked:
- $
apachectl -M
>> it is installed
php_info()
on current server >> says rewrite is installed also
- I also double-checked the
.htaccess
file in my Drupal root folder
- UPDATE: checked httpd.conf for
AllowOverride All
I'm out options here. Looked everywhere but the Drupal settings aren't letting me to enable the settings and their test is simply visiting a site that should work if the rewrite module was there.
My specs:
Mac OS X 10.6 Snow Leopard
Using built-in Apache with PHP5
Thanks!
Two more things to check:
- Verify that your
.htaccess
is readable for your apache processes (Yes, I read that you double checked it, but did that include the file permissions?)
- Enable rewrite logging - this might give you some hints on where it fails. Start with a log level of 5 and increase/decrease as needed. (Don't forget to turn it off again later, as it is a huge performance hog ;)
Also, I'd try to simplify the test scenario - start with a simple rewrite directive in a vhost configuration. Once that works, move it to a .htaccess in the top-level of the vhosts document root, then to sub directories (if needed/used).
Last but not least, you must authorize your virtual host or directory to use .htaccess
.
AllowOverride All
Update:
I can't figure out your exact problem but it's always worth testing that Apache is actually parsing your .htaccess
file. Make a syntax error on purpose and see if you get a 500 Internal Server Error
message. Also, test mod_rewrite
with a simple redirection rule that doesn't involve Drupal.
Make sure that if the install is in a sub-directory that the username is part of the rewriteBase
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
RewriteBase /~username/drupal**
If you running your Drupal installation in a sub-folder like: example.com/drupal, then enable "RewriteBase /" in your .htaccess file, it might help you.
A clean url could be something like www.example.com/fisherman instead of www.example.com/data/pages/fisherman.php
Some installations of apache have clean URL functionality out of the box. There are 2 steps that need to be configured correctly for it to work.
Enable rewrite module
Allow .htaccess file overrides
Both steps require SSH root access to your server. So if you are on shared host this probably won't work for you. Open your terminal:
- Enable rewrite module
To enable the rewrite module, you can type the following command
sudo a2enmod rewrite
Now type
sudo service apache2 restart
to enable the changes. You can check if it’s working by typing
sudo apache2ctl –M
A list will appear. Look for “rewrite_module”.
http://codeontrack.com/enable-clean-urls-apache/
Look for this Line in your httpd.conf file
#LoadModule rewrite_module modules/mod_rewrite.so
If commented
Just uncomment it restart apache server then try enabling in drupal administer Clean URL Section
I added the following to my .htaccess file and it was solved. My problem was specifically hapening with Rackspace / CentOS image
Options -MultiViews
As Álvaro G. Vicario mentioned, the first thing to do is at the top of the .htaccess
file add something like ghfdiddfdjf
which should throw an internal error. If it doesn't, you know the .htaccess
file isn't being read. Mine wasn't, and I found the following fix:
In the etc/apache2/sites-enabled
folder, there was a file called default-000
. It was in this file that I changed AllowOverride All
in 2 places in the file.