Forum Moderators: open

Message Too Old, No Replies

Converting site from .htm to .php

Will the following work?

         

grahamlyth

7:57 pm on Jul 29, 2003 (gmt 0)



Hi all,

I'm currently changing some of my .htm pages over to .php. All my pages are currently listed in Google, and rank quite well for my chosen keyphrases.

My plan is as follows:

1) Rename *all* the .htm files to .php, even those which don't necessarily need it at the moment.

2) Use the following in .htaccess to put a 301 redirect on all requests for .htm files, which will redirect to the .php file of the same name:

RedirectMatch permanent ^(.*)\.htm $1.php

I've tested this line; it appears to work fine, and the server does the 301 properly.

Research on this forum suggests that this will be all fine and hunky-dory with Google, and I've had Google handle less-complicated 301s absolutely fine in the past.

Anything I've overlooked?

Thanks all,

Graham

GoogleGuy

4:54 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like a good plan to me.

cabbie

5:03 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WW grahamlyth.
You cant beat that for service.I post and get a direct response from the horses mouth(excuse my familarity mr GG)

grahamlyth

9:13 am on Jul 30, 2003 (gmt 0)



Thanks GG / cabbie - looks like I'll go with the plan!

Cheers

Marcia

9:26 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>from the horses mouth

hehehe... tres cool, isn't it?

I'm looking over a site now that didn't do that, and it's totally messed up with an .htm and .shtml homepage, PR and internal links (same thing as with a change to .php). It won't be hard to fix, but there's no need for that to begin with if people will check it out in advance and stick to the simple, logical basics.

mark_roach

9:42 am on Jul 30, 2003 (gmt 0)

10+ Year Member



Alternatively you could use .htaccess to treat your htm files as php so that you do not need to rename them.

I think something like the following should work:

AddHandler application/x-httpd-php .htm

Marcia

9:46 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey, LTNS Mark! You're 100% right of course, but some people don't do that in the first place because they don't know. That doesn't mean it's too late, though. So what do people do when Google ends up having both? Sounds like .htaccess is the answer for that in the easiest way possible.

grahamlyth

4:10 pm on Jul 30, 2003 (gmt 0)



mark_roach - thanks for the handler tip. I'll give it a test, as this would indeed be easier than renaming all the .htm files.

Cheers

swones

5:30 pm on Jul 30, 2003 (gmt 0)

10+ Year Member



I also use this to parse htm pages as php, it does mean that pages with no php have to be run through the parser anyway which may be a small performance hit.

You can in fact do something like this to only parse the pages you need:

AddHandler application/x-httpd-php index.htm
AddHandler application/x-httpd-php shop.htm
AddHandler application/x-httpd-php forum.htm

etc
etc

If you do allow all .htm to run through the php then you can also set zlib.output_compression = On in php.ini (if you are on your own server) and this will compress the page code if the browser supports it resulting in faster page loading times. I would advise that you read up on output compression before enabling this though.

Simon.

MrSpeed

7:08 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another potential benefit of mark_roach's method is that some that feel .htm pages rank better than .php pages.

Personally I don't subscribe to that camp.

httpwebwitch

7:18 pm on Aug 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am doing exactly the same thing next month - I am preparing a huge site for conversion from FrontPage (*.htm) into PHP (*.php).

I tested the method above, configuring the .htaccess file to handle HTM files with the PHP parser, and it worked! So far, this is best method I've seen, way better than hacking up a pattern for 301 status errors, since our backlinks can stay intact.

Our company relies heavily on measurements of traffic to our website, most of which comes through the Her Royal Majesty Queen Google. I need to be absolutely certain that we aren't going to be penalized for a "bait-and-switch" - putting new stuff at the same URI where the old stuff used to be.

Can I get comments from anyone who has tried this method, and what it did to your PRs and SERPs?

Cheers,
httpwebwitch

swones

10:44 pm on Aug 29, 2003 (gmt 0)

10+ Year Member



From the w3 consortium site, they say that "Cool URI's don't change", keep the pages where they are, Google won't worry how the content on them was generated, it will just reindex it accordingly next time it passes by. That's what I've always found anyway. Personally I try never to remove a page or alter a sites link structure if possible, with a little careful planning and thought you can usually achieve what you want without losing any already well indexed content.

Harbinger.