# 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 / # 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