You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tim Luoma <lu...@peak.org> on 2002/07/09 16:07:48 UTC
cannot get mod_rewrite example from apache.org for file name extension
change to work
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