Forum Moderators: phranque

Message Too Old, No Replies

.htm to .html Should I do a re-direct?

         

kslnor

9:14 pm on Jun 26, 2007 (gmt 0)

10+ Year Member



For some reason when I launched my site 5 years ago all the pages were suffixed as .htm, rather than .html or .shtml. I am giving the site a total face lift and want to make the pages .shtml for ease of editing (for lack of better reason). Many pages currently rank very well (with the .htm); if I change the suffix will I lose the rank? Is a re-direct necessary (from the .htm to the .shtml). If so, how do I do this? My goal is to preserve the rank. Thank you.

Marcia

9:26 pm on Jun 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just do an entry in .htaccess to parse the .htm pages for SSI. That way you don't have to change file extensions. You can also use PHP includes, so that if you want to run any PHP on the site you can - and still have the same file extensions.

kslnor

10:18 pm on Jun 26, 2007 (gmt 0)

10+ Year Member



Thanks for the quick response, Marcia. Can you please tell me how to do the .htaccess entry? Thanks!

(man, I can't stand dial-up...it stalled during the typing of this message and somehow posted as a new message....sorry moderators! Anyway, I would appreciate an answer to this post if someone can assist. Thanks).

Marcia

11:02 pm on Jun 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are a bunch of threads with the code:

parse HTML for PHP [google.com]

It's similar for SSI but I find it easier with PHP includes. You just put a call for the file in the html code at the place on the page you want the text or navigation links to appear

<?php include ("includes/sideNavigation.php");?>

Or in a /subdirectory/ it would be

<?php include ("..includes/sideNavigation.php");?>

You can use a .php or .txt file extension - it really doesn't matter as long as you're referring to it the right way in the include.

I'm sure this is redundant, so I'm sure someone will correct it, but this is what I've put into .htaccess and it always works, no matter which host

AddType text/html .html .htm
AddHandler server-parsed .html .htm

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

Marcia

8:05 am on Jun 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good thing I read the thread again, it isn't

<?php include ("..includes/sideNavigation.php");?>

It's

<?php include ("../includes/sideNavigation.php");?>