Forum Moderators: coopster
A friend and I are converting a site from *.html to *.php. The site already recognizes the *.php files - and the most current version of PHP is running on the server (*.nix).
We plan to leave the *.html files in place, due to their inclusion in search engine databases and user bookmarks.
Here are my questions, that I would appreciate your help with:
1). Are there any problems or issues that I should be concerned with, considering that I might have both an index.php and an index.html in the directories at the same time (unless there is a better way)?
2). Is there any search-engine-friendly way to add refresh statements (meta or javascript) to some of my html files? If so, please share code example. [I'd only add the refreshes to those pages that are a part of the main site structure - i.e. index.html files in the directories.]
3). If I have to go the parsing html as php method... Is the "AddType application/x-httpd-php .html" statement valid to be in the "current version of PHP's" httpd.conf file? Or, does it need to be like this "AddType application/x-httpd4-php .html" (with the '4' included)? Also, is that all that is needed to make PHP parse *.html as *.php? [By the way, I am somewhat aware of the .htaccess method.]
4). Does anyone have any examples of how speed is affected by having the *.html files parsed as PHP files? If so, please share.... [Speed is of big concern...]
I appreciate your help with this. I need to upgrade this site and there are hundreds of pages that are currently in the search engines that I do not want to interfere with.
I know that I can keep the html pages and have them parsed as php, but I have already built much of the new site (with many links) with php extensions. So, I planned to drop the new site in the directories with the old site. Pages that are not a part of the main structure (main, products, contact, news, .... and other index.html pages, I will just change the links in them to point to the new index.php pages -- but the main index.html will have to remain and have links updated and/or refresh code).
I really need to find some straight-forward help with this, so that I can do it in a way that will not hinder the site's standing in the search engines.
Thanks!
3). If I have to go the parsing html as php method... Is the "AddType application/x-httpd-php .html" statement valid to be in the "current version of PHP's" httpd.conf file? Or, does it need to be like this "AddType application/x-httpd4-php .html" (with the '4' included)? Also, is that all that is needed to make PHP parse *.html as *.php? [By the way, I am somewhat aware of the .htaccess method.]
AddType application/x-httpd-php .htmlor similar in your http.conf file is all what's needed to make php parse .html files - if php is already installed for .php files. the parameter "application/x-httpd-php" or similar depends on the type/action definitions in your httpd.conf. if the php action was added to the type "rainbowcolors/green" then you should use
AddType rainbowcolors/green .htmlto get it processed like .php files. i think you get what i mean.
for .htaccess you can use the following method:
<FilesMatch "\.html$" >
ForceType application/x-httpd-php
</FilesMatch> but AddType should do the job here, too.
Thanks for the welcome.
I'm thinking that simply parsing my html isn't going to do the trick for me, as I will be dropping in my PHP site on top of the HTML site.
So, I will have HTML files and PHP files (e.g. index.php and index.html) in the same directories.
Any advice or comments on how to make this all work -- keeping the search engines indexing of the old *.html files in mind?
Thanks.
Raeba
RewriteEngine On
RewriteRule ^(.*)\.html$ /$1.php [R=301,L]
This should make incoming links redirect to the .php files, and will tell search engines to start indexing the .php files instead because of the 301 status (moved permanently). This only works on html files in the root folder. You may have to modify it to make it work for html files in subfolders.
Now you can move all of your .html files to .php and it should work.
I've heard many horror stories about how people's page were dropped from search engines doing it that way.
Don't you think if I were to change the order by which index pages load that it would be better?
Specifically, I was thinking of changing the DirectoryIndex index order to: index.php index.htm index.html (rather that the current way: index.htm index.html index.php).
This would allow the index.html pages to continue to remain in the search engines and co-exist with the index.php files.
I could go into the index.html files and change any links to point to the new *.php pages - while keep the overall file and content intact.
What do you think of that?
Raeba
I do something similar to the example that mattx17 gave. The difference is that I don't issue the 301 code.
RewriteRule ^(.*)\.html$ /$1.php [L]
This method allows the page I want, in this case a php page, to be displayed instead of the html page. As far as the spiders go, or anyone else, they think they are getting the html page. Result, no loss in SERP's due to renaming all the pages. There are also good arguments given for not displaying any file extentions - and the reasons given are for what you are doing now. If you change the page, it doesn't matter, because the extention (html, php, asp) is never given anyway. Might be something worth looking into.
Another issue I had with converting to php was the page headers. Normal html headers are different from normal php headers. I wanted my pages to appear to be regular html documents, so I had to modify the headers sent with my php pages. There was a very recent example of this given in this forum. If you can't locate it I'll be happy to repost.
You can use this tool [webmasterworld.com] to check your headers.