I've got fresh install of Apache 2.2 on my Vista machine, everything works fine, except mod rewrite.
I've uncommented
LoadModule rewrite_module modules/mod_rewrite.s
but none of my rewrite rules works, even simple ones like
RewriteRule not_found %{DOCUMENT_ROOT}/index.php?page=404
All the rules I'm using are working on my hosting, so they should be ok, so my question is, is there any hidden thing in apache configuration, that could block mod rewrite?
Best Answer
In order to use
mod_rewrite
you can type the following command in the terminal:Restart apache2 after
or
or as per new unified System Control Way
Then, if you'd like, you can use the following
.htaccess
file.The above
.htaccess
file (if placed in yourDocumentRoot
) will redirect all traffic to anindex.php
file in theDocumentRoot
unless the file exists.So, let's say you have the following directory structure and httpdocs is the
DocumentRoot
Any file that exists in httpdocs will be served to the requester using the
.htaccess
shown above, however, everything else will be redirected tohttpdocs/index.php
. Your application files inincludes/app
will not be accessible.