httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Luoma <>
Subject cannot get mod_rewrite example from for file name extension change to work
Date Tue, 09 Jul 2002 14:07:48 GMT

Summary:  Trying to use mod_write so that requests for FOO.html in a 
certain directory actually go to FOO.php but still getting 404 on FOO.html

I have a bunch of files formerly named like this
which are now named like this:

I went right to the docs and found what I wanted (I thought) at

I modified the RewriteBase and changed "document.phtml" to 
"document.php" and came up with this:

#   backward compatibility ruleset for
#   rewriting document.html to document.php
#   when and only when document.php exists
#   but no longer document.html
RewriteEngine on
RewriteBase /weblog/archives/
# parse out basename, but remember the fact
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
# rewrite to document.php if exists
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1]
# else reverse the previous basename cutout
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.html

However I am still getting a 404 on

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message