Hi Experts:
I'm having troubles to make mod_rewrite work on my local server. I'm running Apache 2 in Windows XP, with mod_rewrite enabled.
In my httpd.conf file, I made the following change:
1. enabled mod_rewrite (by uncommenting the mod_rewrite script)
2. Added an alias and setup directory access for the alias
Alias /mysite "D:/mysite/"
<Directory "D:/mysite/">
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>
That's pretty much all I changed in httpd.conf
Then under D:/mysite/, I created two PHP scripts, index.php and test.php. Basically what I want to do is to rewrite every request to index.php, so I created an .htaccess file and put in the following:
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css
)$ index.php
So I tried the following link:
http://localhost/mysite/index.phpbut got the following error:
Forbidden
You don't have permission to access /mysite/index.php on this server.
Then I tried to turn off RewriteEngine, made the change in .htaccess
RewriteEngine off
This time
http://localhost/mysite/index.php works. But obvious turning the engine off is not what I want.
So I did some research and made a little adjustment in <Directory>...</Directory>
<Directory "D:/mysite/">
AllowOverride All
Options +FollowSymlinks
Order allow,deny
Allow from all
</Directory>
As you see I changed the Options part. (from None to +FollowSymlinks)
This time
http://localhost/mysite/index.php works fine. But when trying to access test.php,
http://localhost/mysite/test.php, I got the following error:
Bad Request
Your browser sent a request that this server could not understand.
I'm an Apache starter and this is giving me major headache. Any help will be really appreciated!!!