Page 1 of 1

mod_rewrite not working

Posted: Wed Sep 06, 2006 7:51 am
by Ree
I'm running Windows XP and Apache 2.0.something. To enable mod_rewrite, I uncommented the following line and restarted the server:

Code: Select all

#LoadModule rewrite_module modules/mod_rewrite.so
phpinfo() does display mod_rewrite in loaded Apache module list. I have created a test folder inside /htdocs and put .htaccess there:

Code: Select all

RewriteEngine on
RewriteRule ^foo\.htm$ /bar.htm [L]
This rule should display the contents of bar.htm when foo.htm (http://localhost/test/foo.htm) is requested (which does not exist physically). However, I get 404 so it seems the mod_rewrite rule didn't work.

Why is that so?

Posted: Wed Sep 06, 2006 12:19 pm
by John Cartwright
You'll need to set

Code: Select all

RewriteBase /test/
for that rule to work, I believe.