httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Luoma <luo...@peak.org>
Subject cannot get mod_rewrite example from apache.org 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


Description:
I have a bunch of files formerly named like this
    http://www.tntluoma.com/weblog/archives/00000014.html
which are now named like this:
    http://www.tntluoma.com/weblog/archives/00000014.php

I went right to the docs and found what I wanted (I thought) at 
http://httpd.apache.org/docs/misc/rewriteguide.html

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 
http://www.tntluoma.com/weblog/archives/00000014.html





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message