views:

137

answers:

4

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!

+4  A: 

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.

Álvaro G. Vicario
Yeah, this is the big thing you didn't mention. This line needs to go somewhere in your httpd.conf file.
Scott Reynen
+1 because it would definately help someone. For some reason I couldn't solve it still. I made the change in my httpd.conf file (I know i'm editing the correct one) and I then restarted the apache server. It didn't help :(
WmasterJ
+1  A: 

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.

Zydrunas
Tried this and it doesn't seem to help.
WmasterJ
Did you solved this problem? It is possible, that apache does not read .htaccess file. Try to insert some dummy text stuff inside .htaccess and try to load your page. If you get errors on screen, then it's somewhat other problems related to apache / php config. But if you get no error, then it is apache config (sites-enabled) problems.
Zydrunas
A: 

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

kantu
Thank you. But if you read my question you will see that I checked both the `apachectl -M` (which shows all active modules) and also php_info() which also shows the currently active modules.
WmasterJ
+2  A: 

Two more things to check:

  1. 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?)
  2. 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).

Henrik Opel
Thank you, changing the file permissions worked for some reason. In the start it was: 644 (`-rw-r--r--@`) I changed it using the command `chmod 777` which gave me (`-rwxrwxrwx@`). I then restarded Apache and it worked :) ...strange thing is that when I turned it back to 644 it still worked. Any idea why?
WmasterJ
@WmasterJ: That is strange indeed, and I have no idea why. Unless it is a really strange glitch with the permission settings (which I doubt), the most obvious reason would be that you changed something else that fixed your issue, but just needed the apache restart to take effect!?
Henrik Opel
Probably that was the case :<
WmasterJ