Home > Code > Mod Rewrite Not Working

Mod Rewrite Not Working

August 17th, 2010 Leave a comment Go to comments

I searched for a solution to my problem of Mod Rewrite Not Working and the advice was rather obvious such as to make sure you remove the hash (#) symbol before the mod rewrite extension inclusion line in Apache httpd.conf where you see LoadModule rewrite_module modules/mod_rewrite.so

But what solved it for me was recognizing that the default setting for any directory on the server is for a very restrictive set of services.

The actual text is:

# First, we configure the “default” to be a very restrictive set of
# features.

Given that the httpd.conf is very well commented, it does make sense to take the time to read all of the comments before you hit the web and start going down rabbit holes seeking answers to why your .htaccess is not working etc.

A crucial directive is:
AllowOverride None

This is the cause of .htaccess rules being ignored.

So in your root document directory settings, for example, you want to have:

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

AllowOverride All

So do this and restart the Apache server and your Mod Rewrite should work just fine to get the fancy URLs etc.

Post to Twitter

Categories: Code Tags:
  1. No comments yet.
  1. No trackbacks yet.

CommentLuv Enabled