Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite all .html to .php

         

rapidcars

2:44 am on Oct 25, 2004 (gmt 0)

10+ Year Member



I've been searching around but can't find how to do this. I changed all my pages from .html to .php and want to redirect all the .html files to .php I read that you can just have the server parse all .html files like .php but I don't want to do that because I've already created the .php files and the site is already using them.

Thanks

outrun

3:07 am on Oct 25, 2004 (gmt 0)

10+ Year Member



You shouldnt put unneeded extra strain on the server when you can just rename all your files from php to html and they do the same thing.

regards,
Mark

jdMorgan

3:47 am on Oct 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Compared to running PHP or PERL, the added "strain" is negligible. You can place the directive

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

in httpd.conf or in your Web root .htaccess file.

This is an external 301-Moved Permanently redirect. If you wish to simply serve php files instead of html files, without notifying the client that the URL has changed, you can do that with mod_rewrite. The advantage of using an external redirect is that it informs search engines that your pages have been replaced.

Jim