Forum Moderators: phranque

Message Too Old, No Replies

.PHP v. .HTML

Which is best for SEO?

         

Maynard

12:51 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



Our site is being redesigned and all HTML file extensions will be changed to .PHP. Currently our site ranks very highly on Google and we get a huge chunk of our referrals from it. Will the file extension change affect our ranking/indexing/SEO?

pageoneresults

1:01 pm on Apr 20, 2004 (gmt 0)

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



Will the file extension change affect our ranking/indexing/SEO?

Yes. If all of those .htm file extensions are indexed, then you've got some work cut out for you if you plan on changing them to .php.

There are different ways to approach this issue. I think the best alternative would be to do Content Negotiation at the server level and eliminate all file extensions.

The second option would be to place a 301 Moved Permanently redirect from the old-page.htm to the new-page.php.

The third option would be to leave the .htm pages as they are. You state that Google represents a big chunk of your referrals. Those will surely die for a bit while Google figures out what is going on with your site.

You've also got inbound links to consider. Unless you plan on personally contacting all of your link partners and instructing them on the change, you will be creating a mess for yourself.

But, it is not only Google you need to worry about. There are other spidering entities that are just as important. They may not be as smart as Googlebot or as quick.

I've found that the change of file extensions may take anywhere from 60-120 days before seeing final results. Even then, there will be ghosts still floating out there.

P.S. Depending on how many pages are indexed, you might want to start with just changing a few of the pages. Do it in groups over time.

encyclo

3:02 pm on Apr 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But why change the file extension? You should only ever change a file name as a last resort, and it is trivial to have .HTM files parsed as PHP.

The bigger problem comes if you are changing the site's structure as well as the file extension. In that case, you must use a 301 redirect for every old page and redirect them to the equivalent new page.

Maynard

3:13 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



Yes, some of the file structure is changing and much of the existing content is being broken down into shorter pages (therefore one page bcomes four pages). I think 301 redirects may be our only option - that should get around the search engine indexing problem and eventually when they index our new pages we can delete the old ones.

I did also think of using META refresh and a redirect to new URL. With a 3 second delay I can urge users to update their links/bookmarks.

What do you think?

encyclo

3:19 pm on Apr 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't bother with the meta refresh - it will damage your attempts to have the new pages indexed, and most users won't change their bookmarks anyway. 301 is the only way to go - and you should leave them in place for a very long time until the new file structure is well established (absolute minimum 12 months).

bill

1:14 am on Apr 21, 2004 (gmt 0)

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



Go with encyclo's earlier suggestion...parse .htm or .html files as .php
I use the following in my .htaccess file...

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

Eric_Lander

1:46 am on Apr 21, 2004 (gmt 0)

10+ Year Member



Bill has it right assuming you've got the right server setup. I've used this countless times -- each time being successful.

corz

3:58 am on May 12, 2004 (gmt 0)

10+ Year Member



addtype is a good technique, and useful for other things, too.

for instance, say you have a file which contains html structures, included in some php script, and it has a .blog extension. normally, if some one accessed this file directly, Apache would output the source markup as raw plain text. however, piping it through the php machine..

AddType application/x-httpd-php .blog

magically transforms the output to readable html. neat.

but for what you're trying to do, I would simply add the following..

RewriteEngine on
RewriteRule ^(.*)\.html $1\.php

to my .htaccess file. from now on, all requests to whatever.html will load whatever.php in its place, you can write nice php pages, perhaps including the old html content, and the url remains html. you and your inwards linkers can upgrade at their leisure, meanwhile, the search engines get double-helpings of your content.

as an added bonus, this allows you to easily split php code and included html structures into two separate files, always a nice idea. folks can link to whatever.html or whatever.php, but they'll always they get whatever.php in their browser, and this will still work even if whatever.html no longer exists!

;o)
(or

Maynard

12:27 pm on May 17, 2004 (gmt 0)

10+ Year Member



A great idea, corz. Would there be any time delay to serve the page to the user?

corz

4:28 am on May 18, 2004 (gmt 0)

10+ Year Member



nup. nothing anyone would notice.
try it at my site.

;o)
(or

ps. on my site, it's .htm that maps to .php

Marcia

4:41 am on May 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just confirming NOT to put up the pages with different file extensions and NOT to use meta-refresh. I've watched some site completely lose rankings at Google for doing just that very thing, and Yahoo hasn't even caught it yet.

photonstudios

3:45 pm on Jun 10, 2004 (gmt 0)

10+ Year Member



When I add:

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

It tries to download .html file every time it requests it, how do I fix this problem?