I am going to change the file extension from ".htm" to ".php", is there any disadvantage with this action?
feedback
|
migrated from stackoverflow.com Apr 2 '11 at 1:51
This question came from our site for professional and enthusiast programmers.
|
Yes. If you change the file extension of a live site the following consequences will occur:
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:
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). | ||||
|
feedback
|
|
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:
Stick with "htm" or omit the extension whatsoever. If you feel adventurous, you can make extensions part of the personality of the website. This is how Ars Technica does it. URLs for their articles end wih .ars: Is "ars" a programming language? Not at all, this is just a little element in their visual identity system. A simple and brilliant idea I think. | |||
|
feedback
|
|
There certainly can be an SEO impact. At the very least you should create 301 redirects so that the search engines -- and anyone who has bookmarks -- won't find broken pages. | |||
|
feedback
|
