View Full Version : Redirect *.htm to *.php

02-03-2004, 10:16 PM
I'm wanting to automatically redirect all requests for *.htm or *.html to a *.php file by the same name.

How could I do this with htaccess? I've googled and searched on this forum to no avail...

02-03-2004, 10:33 PM
By using Apache's mod_rewrite. See <http://www.modrewrite.com/>.

02-04-2004, 02:02 AM
I figured that much. I've spent the last hour trying to get all *.htm and *.html requests to redirect to *.php files by the same name (in all directories), but it plain isn't working.

I'll keep working at it, but meanwhile has anyone got a specific script that I can just drop into my .htaccess file?

02-04-2004, 09:38 PM
RedirectMatch permanent (.*)\.html$ $1.php


RewriteEngine on
RewriteRule ^(.*)\.htm[l]?(.*) /$1.php$2

02-22-2004, 01:27 AM
You can use .htaccess to make the server parse .htm and/or .html files. The there would not be an issue, keep the extensions as they were originally.