Forum Moderators: coopster
What would be the easiest and best way to switch to the .php extensions for the search engines? Should I leave the original .html files there and just put the .php pages on the site map to get indexed (although I am afraid this will be considered duplicate content), or should I use redirects and just suffer a search engine ranking drop on my pages? Or is there any way to keep the rankings? Any help is greatly appreciated.
Thanks
[webmasterworld.com...]
"Assuming you are on apache add these lines to .htaccess
AddHandler php-script .php .htm .html
AddType text/html .php .htm .html
This will treat all .htm or .html files as PHP"
So I can use PHP server side includes and it will work with an HTML page? If so this would work great, although I will have to get my host to change the .htaccess for me, as I don't have access to it as for as I know.
As far as redirects, I'm guessing I will lose some search engine rankings for awhile, but I may do this to benefit more in the long run.
<!--#include "somefile.html"-->
will do the same thing as:
<?php include "somefile.html"?>
does on a PHP-enabled server.
Many commercial hosts do not enable SSI when your hosting account is one-of-many on a machine, as it slightly increases the load put on the server as it compiles the page for delivery. Ask your provider.
Also, you may not see your .htaccess file in your FTP program because the prepended dot causes it to be hidden. Often, if it exists, you can specify that it is the name of the files you wish to transfer, and even if you can't see it, it usually works. Likewise, you may be able to telnet/SSH into the server and find/modify the .htaccess file, which will not be hidden in that environment.
2) AddHandler php-script .htm .html
Registers the executable scripts.
3) AddType text/html .htm .html
Registers text rendering.
(2) and (3) together approximate (1).
BTW: Any type of server side parsing and compilation, like SSI or PHP, will cause the server to take a hit. It's not too bad unless you have a lot of traffic.
Adding the line to your .htaccess file limits the files parsed to files in that directory.
Adding the line to the server configuration file and restarting the server applies the instruction to every file on your web server with those extensions. This means that every .htm and .html file will be parsed and compiled by PHP before delivery, regardless of whether or not you used PHP in those files.