mod_rewrite Not Working in .htaccess

Here is the solution along with how you can debug mod_rewrite problems.

Debugging procedure:
Add these two line to your httpd.conf immediately after RewriteEngine On.
RewriteLog “/var/log/httpd/rewrite_log”
RewriteLogLevel 9
After that I added the required RewriteRule etc.

The reason for testing directly in httpd.conf is to ensure that mod_rewrite is working in the first place. After some debugging I realized my expression was wrong. So now I found mod_rewrite was working in httpd.conf. However it still wasn’t working in .htaccess files.

I found AllowOverride was set to None in httpd.conf. I changed it to All (after all I am the only user of the machine). And it finally started working everywhere (after a restart).

  1. Leave a comment

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: