Loans - Secured Loans - Fast Loans - Cheap Car Insurance - Weight Loss

PDA

View Full Version : Mod_ReWrite


mnemtsas
Nov 28th 2004, 6:48 pm
Hi,

I'm in the process of swapping over from static HTML to PHP. From what I understand to not lose all of the hard earned SEO I've done I need to rewrite a request for foo.htm to foo.php . After a while on Google (I'm obviously using the wrong search terms) I cannot for the life of me figger out how to do this.

Can someone lend a dummy at hand?

I want to rewrite foo.htm to foo.php so that someone who requests foo.htm is actually served foo.php.

Cheers,

Mark

quadcity
Nov 28th 2004, 7:46 pm
Hello Mark.
I think you might be able to configure your server to parse .htm files as well as .php files. (Although I could be thinking of another scripting environment.)

Hopefully somebody here can give a more authoritative answer.

mnemtsas
Nov 28th 2004, 8:49 pm
Hi Quadcity,

Yes that's exactly what I need to do, I've managed to find the right combination of words to type into google and come up with the following:

Add another apache type using:

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

in my .htaccess files. This means anything in a html file is parsed with php.

Cheers,

billion
Nov 29th 2004, 1:19 am
This is what I use in my .htaccess file:

RewriteEngine on
RewriteRule ^(.+)\.html $1.php [QSA]

It will probably work for you too. Keep in mind that it effects the directory you put it in + directories below this directory.

If you use .htm make sure to change .html to .htm in the code above. :)