Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite question

         

designaweb

10:52 am on Dec 7, 2002 (gmt 0)

10+ Year Member



Can someone tell me why this one does work:


RewriteEngine on
RewriteBase /test/
RewriteRule ^day\.html$ /night.html [L]

and this one doesn't?


RewriteEngine on
RewriteBase /test/
RewriteRule ^day\.html$ /index.php [L]

I have 4 files in same dir,
- .htaccess (containing one of the above codes)
- day.html
- night.html
- index.php

designaweb

10:55 am on Dec 7, 2002 (gmt 0)

10+ Year Member



Here's the errorlog:

192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (2) init rewrite engine with requested uri /test/day.html
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (1) pass through /test/day.html
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (3) [per-dir c:/program files/apache group/apache/htdocs/test/] strip per-dir prefix: c:/program files/apache group/apache/htdocs/test/day.html -> day.html
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (3) [per-dir c:/program files/apache group/apache/htdocs/test/] applying pattern '^day\.html$' to uri 'day.html'
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (2) [per-dir c:/program files/apache group/apache/htdocs/test/] rewrite day.html -> /index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (2) [per-dir c:/program files/apache group/apache/htdocs/test/] trying to replace prefix c:/program files/apache group/apache/htdocs/test/ with /test/
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88a988/initial] (1) [per-dir c:/program files/apache group/apache/htdocs/test/] internal redirect with /index.php [INTERNAL REDIRECT]
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88c3f0/initial/redir#1] (2) init rewrite engine with requested uri /index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88c3f0/initial/redir#1] (1) pass through /index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#869d90/initial/redir#2] (2) init rewrite engine with requested uri /php/php.exe/index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#869d90/initial/redir#2] (1) pass through /php/php.exe/index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88c9a0/subreq] (2) init rewrite engine with requested uri /index.php
192.168.1.2 - - [07/Dec/2002:11:58:36 +0100] [www.testing.nl/sid#7859b0][rid#88c9a0/subreq] (1) pass through /index.php

andreasfriedrich

3:05 pm on Dec 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The rewriting does work as the error log shows. Is PHP configured correctly? Can you access index.php directly? Are you using some kind of Alias for PHP? Then you would need to add the PT flag to your RewriteRule.

Andreas

designaweb

3:23 pm on Dec 7, 2002 (gmt 0)

10+ Year Member



I can read the PHP file directly, and I dont know what an Alias for PHP is...

andreasfriedrich

3:37 pm on Dec 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The funny line in the error log is this:

init rewrite engine with requested uri /php/php.exe/index.php

Have you tried running PHP as a module within Apache?

AddType application/x-httpd-php .php

Just try adding PT to your RewriteRule:

RewriteRule ^day\.html$ /index.php [L,PT]

Andreas