I'm running Windows 7 64 bit with WAMPServer 2.1. The version of Apache running is 2.2.17. I'm trying to set up a simple rewrite rule in httpd.conf
:
<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [PT,QSA,L]
</IfModule>
I've gotten simpler RewriteRules to work previously, without regex, rewrite expressions, and the like. It seems that at this point, however, I'm getting a 400 Bad Request
error whenever attempting to visit any URL when this rule is active. The Apache log file gives these errors whenever this happens:
[Sat Feb 26 10:24:18 2011] [error] [client 127.0.0.1] Invalid URI in request GET /index.php HTTP/1.1
[Sat Feb 26 10:24:21 2011] [error] [client 127.0.0.1] Invalid URI in request GET / HTTP/1.1
The first error I tried hitting localhost/index.php
. The second I just tried localhost
.
Furthermore, even when I had the simpler rule working, the RewriteCond
lines didn't seem to be working: static existing files such as style.css were being rerouted anyway.
Enabling RewriteLogging just seems to crash Apache, which appears to be a documented issue on 64-bit machines running Windows 7. Any ideas as to what the problem may be?