mod_rewrite not working

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

mod_rewrite not working

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You'll need to set

Code: Select all

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