Current position:  Home > Default > Mod_rewrite RewriteRule's not working...

Mod_rewrite RewriteRule's not working...

Time:December 10
Advertisement
i'm trying to utilize mod_rewrite on my OS X 10.4.8 server but even the simplest rule isn't being executed. not sure how to read my rewrite .log but it looks like all my rules / "pattern" are being applied to '/server-status' ?
i've tried to write rules in the .htaccess file but these don't seem to be recognized either.
thanks for any advice or direction,
./james
mod_rewrite settings for "httpd.conf"
LoadModule rewrite_module libexec/httpd/mod_rewrite.so
AddModule mod_rewrite.c
<IfModule mod_rewrite.c>
RewriteLog "/var/log/rewrite.log"
RewriteLogLevel 9
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
# this simple rule james.html --> emit.html doesn't work...
RewriteRule ^james\.html$ emit.html
RewriteRule ^/page/(.*)$ /cgi-bin/WebObjects/PWDA.woa/wa/loadPage?pageId=$1 [L,PT,QSA]
</IfModule>
output from "rewrite.log"
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (2) init rewrite engine with requested uri /server-status
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (3) applying pattern '.*' to uri '/server-status'
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (3) applying pattern '^/page/(.*)$' to uri '/server-status'
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (1) pass through /server-status
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (2) init rewrite engine with requested uri /server-status
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (3) applying pattern '.*' to uri '/server-status'
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (4) RewriteCond: input='GET' pattern='^TRACE' => not-matched
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (3) applying pattern '^/page/(.*)$' to uri '/server-status'
127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (1) pass through /server-status
Advertisement
The log entries are a red herring.
If you look at the first line of the log:
<pre class=command>127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (2) init rewrite engine with requested uri /server-status</pre>
This is mod_rewrite's way of telling you that it just saw a request for /server-status - that is the request from the client.
It then walks through the rules and none of them apply so it exits with:
<pre class=command>127.0.0.1 - - [05/Jan/2007:10:18:52 -0500] [127.0.0.1/sid#1802648][rid#18b3038/initial] (1) pass through /server-status</pre>
In other words, none of the rules match, so the request passes through.
Nowhere here do I see a hit that matches the rules and would therefore get rewritten.
What happens if you actually hit http://localhost/page/something ? does it get rewritten?