Mobile app version of vmapp.org
Login or Join
Odierno851

: SEO - Changing file extension I am going to change the file extension from ".htm" to ".php", is there any disadvantage with this action?

@Odierno851

Posted in: #Seo

I am going to change the file extension from ".htm" to ".php", is there any disadvantage with this action?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno851

2 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah324

John's answer says it all but I would like to ask you yet another question - what is the point? There are at least two reasons for which you should stick with html or have no extension at all:


What you serve to the browser is not a PHP file but an HTML document. This means that the PHP extension is simply misleading. Yes, the HTML is generated using PHP but it is still HTML.
You make your URLs dependent on the implementation of your website (PHP in this case). What if you change your implementation in the future? Will you change the URLs again? URLs are part of the user interface and they should have a well designed, implementation-independent logic behind them. They should also be clear and informative for the visitor and change only if it is absolutely necessary.


I recommend to stick with htm or omit the extension whatsoever. If you feel adventurous, you can make extensions part of the personality of the website and using anything you like.

10% popularity Vote Up Vote Down


 

@Sarah324

Yes. If you change the file extension of a live site the following consequences will occur:


You are essentially changing the URLs and making all of your pages look like new pages to the search engines.
Any links you had to those pages will essentially be lost
You will need to have the search engines re-index every page that has the new extension
While the search engines make the transition from your old URLs to your new URLs anyone who finds your site in the search results will be greeted with a 404 error on your website
Anyone who had your pages bookmarked will no longer be able to find those pages (until they update their bookmarks)


Fortunately all this is easy to solve. You can do a 301 redirect from the old URLs to the new URLs. This is very easy if the file names are staying the same and only the file extensions are changing. To do the 301 redirect for your pages just create a file called .htaccess and place it in your root directory. Place this inside of it:

RewriteEngine on
RewriteRule (.*).htm$ /.php [R=301,L]


What this does is tell the search engines, and web browsers, that your pages have moved and where to find them (it tells them that the pages that ended with .htm now end with .php). The search engines will then update their indexes with the new pages and also credit whatever links you have to the old URLs to the new URLs (although a small amount of those links' value is lost). Web browser will automatically redirect the user to the new page and they won't even know it happened.

FYI, file extension does not affect your rankings. In other words, .php is not better or worse then .html or .aspx, etc. (Actually if someone is searching for "php" you'll notice Google will highlight the file extension in the search results. But if this is a factor in their rankings it probably is a small one).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme