1
   

Convert Site from HTML to PHP

 
 
B-truE
 
Wed 16 Feb, 2005 12:32 pm
Hi,

I'm 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).

I 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!

B-truE
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 12,257 • Replies: 9
Topic Closed
No top replies

 
Craven de Kere
 
  2  
Thu 17 Feb, 2005 12:42 am
Re: Convert Site from HTML to PHP
B-truE wrote:
I plan to leave the *.html files in place, due to their inclusion in search engine databases and user bookmarks.


For SEO this is not a good idea.

Quote:
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)?


Yes, depending on your server configuration only one will work unless they are explicitly requested. There's no real reason to keep both.


Quote:
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.]


Use mod_rewrite to give a 301 redirect to the php version of the page. The 301 redirect is search engine friendly.


Something like this:

Code:RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php



Quote:
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.]


I'd not do this if I were you, it would increase the load for every html page to have it parsed in the php engine and while it may be negligible I don't see any significant benefit.

Quote:
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 don't have any bench marks to show you, but put it this way. When Able2Know is crawling under a heavy load, the static portal pages usually are a lot faster.

You should have little difficulty finding a whitepaper on php benchmarking if you need specifics.
0 Replies
 
B-truE
 
  1  
Thu 17 Feb, 2005 01:46 am
Re: Convert Site from HTML to PHP
Craven de Kere wrote:

For SEO this is not a good idea


Why not, specifically?

Quote:

Yes, depending on your server configuration only one will work unless they are explicitly requested. There's no real reason to keep both.


That is the same as it is always for files. They must be explicitly requested. The only files which are not are those that are configured in the httpd.conf (e.g. index.*) that load when directories are called.

The only thing that is changing is that the index.php is loading now as the directory default, rather than the index.html. The index.html becomes just another file in the directory - like foobar.html...

This will remain the same, if one, two, or even more index.* files are in the directory.

There are called in order as defined by the "DirectoryIndex" designator in Apache's httpd.conf file.

I was considering keeping both, because the index.html files are specifically named in the search engines. The new index.php files are not and may not be for many months or longer.

The index.HTML files will serve when they are explicitly called, otherwise the index.PHP files will load with directory calls (and from links within the files that I have updated the links in).

Do you still see a problem with this? IF so, please explain.

Quote:

Use mod_rewrite to give a 301 redirect to the php version of the page. The 301 redirect is search engine friendly.
Something like this:
Code:RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php



I've heard about people using the following:

Code:
RewriteEngine On
RewriteRule ^(.*)\.html$ /$1.php [R=301,L]


They had problems with the search engines dropping their rank/standing. It went don't dramatically.

By the way, does your example cover all the sub-directories or just the main dir?

Also, why do people use the .htaccess files to do things like this? Is it because they do not have root access or something?

Quote:

I'd not do this if I were you, it would increase the load for every html page to have it parsed in the php engine and while it may be negligible I don't see any significant benefit.


I agree about not using it, and I too believe that the speed deciine would be mostly not noticed. The pages will be parsed either way -- html or php.

It's amazing how many people suggest that method though.

Craven, I used this forum to ask, because I know how good you are at this stuff, and I know that the forum attracts great people too.

Please let me know what you think about how I am planning to proceed (i.e. re-ordering the index.*). Specifically, if you know of any problems with this way.

Thanks a lot.

B-truE
0 Replies
 
Craven de Kere
 
  2  
Thu 17 Feb, 2005 02:00 am
Re: Convert Site from HTML to PHP
B-truE wrote:
Craven de Kere wrote:

For SEO this is not a good idea


Why not, specifically?


Because it will perpetuate the problems you have with duplicate content and files. The permanently moved redirect is there for a reason.

Quote:
I was considering keeping both, because the index.html files are specifically named in the search engines. The new index.php files are not and may not be for many months or longer.


If I did it on my site they would be indexed within 24 hours. On most sites it will be faster than a month (Google comes around more frequently than that doesn't it?).

Quote:
Do you still see a problem with this? IF so, please explain.


The problem is that you have split the value of your content between two files. Using a 301 redirect will make search engines use the new one and should preserve the rank of the old page.

Quote:
Quote:

Use mod_rewrite to give a 301 redirect to the php version of the page. The 301 redirect is search engine friendly.
Something like this:
Code:RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php



I've heard about people using the following:

Code:
RewriteEngine On
RewriteRule ^(.*)\.html$ /$1.php [R=301,L]


They had problems with the search engines dropping their rank/standing. It went don't dramatically.


I can't vouch for what others do, but Google's employees have repeatedly advocated 301 redirects for what you need to do. Your rank for the old pages is going to fall anyway, unless you keep linking to them.

Quote:
By the way, does your example cover all the sub-directories or just the main dir?


Depends on what other .htaccess files in other directories have. Apache will look recursively from the directory the file is in up to the root directory.

Quote:
Also, why do people use the .htaccess files to do things like this? Is it because they do not have root access or something?


Yes, and because shared hosting means that sometimes it's more convenient to keep the code in the site's own directory.

The speed advantage of having rewrite rules in httpd.conf is sometimes not outweighed by the advantage people see in having all a site's code reside within the site's directory.

Quote:
Please let me know what you think about how I am planning to proceed (i.e. re-ordering the index.*). Specifically, if you know of any problems with this way.


As I've said, the way I'd do it is with 301 redirects. I've done it many times without any problems and it's the only way to get offsite inbound links to still work for your new pages.

Note: you should probably use this chance to make sure this won't happen to you again.

See here: http://www.w3.org/Provider/Style/URI.html
0 Replies
 
B-truE
 
  1  
Thu 17 Feb, 2005 02:17 pm
Craven,

I am following you somewhat... But, I have many thousands of HTML files. I am not going to make a .php file for all of them. So, redirecting html to php may pose a problem there(?)

I was just going to make php files for the main website pages (links off the main page), and leave all the other html files there (which for some I will have to change links in them, because they point to main structure pages with html extensions -- so, I'll change them to just dir calls e.g. main/).

Is this still not a good way? I'm a little confused about putting in a redirect statement - since there are not thousands of php files to represent the thousands of html files.

Hope I am clear Smile

Thanks for your help and patience.

B-truE
0 Replies
 
B-truE
 
  1  
Fri 18 Feb, 2005 02:13 pm
Craven,

How do you think the search engines will treat my use of the following code?:

Code:
# First, rewrite any requests for "/" in any subdirectory to index.html
RewriteRule ^(.*)/$ $1/index.html
# Then rewrite requests for /index.html in any subdirectory to index.php
RewriteRule ^(.*)/index\.html$ $1/index.php
# Finally, if the php file does not exist, then change the request back to index.html
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^(.*)/index\.php$ $1/index.html [L]


I was planning to add that code to my httpd.conf file.

Thanks.

B-truE
0 Replies
 
Craven de Kere
 
  2  
Fri 18 Feb, 2005 05:21 pm
If you don't have too many pages to rewrite then you can always use specific rules for the ones you do.

As to the rules you posted I don't like them at all. I really don't like / going to index.*

If I were in your situation, I would rename all files (might as well get it out of the way in case they become dynamic later) and rewrite them all.
0 Replies
 
B-truE
 
  2  
Fri 18 Feb, 2005 05:43 pm
Craven de Kere wrote:

If I were in your situation, I would rename all files (might as well get it out of the way in case they become dynamic later) and rewrite them all.


Would the following be a good way to do this:

Code:
Redirect 301 /index.html
http://www.afakedomain.com/index.php
Redirect 301 /news/index.html
htt*p://ww*w.afakedomain.com/news/index.php
Redirect 301 /contact/index.html
htt*p://ww*w.afakedomain.com/contact/index.php


If the above is added to the .htacess file in the main domain dir (public_html/) would that please the search engines and help my situation?

I know you don't care much about what others have said, but this is pertinent...

Code:
# First, rewrite any requests for "/" in any subdirectory to index.html
RewriteRule ^(.*)/$ $1/index.html
# Then rewrite requests for /index.html in any subdirectory to index.php
RewriteRule ^(.*)/index\.html$ $1/index.php
# Finally, if the php file does not exist, then change the request back to index.html
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^(.*)/index\.php$ $1/index.html [L]


I've read that the above 'RewriteRule' code "is absolutely the most SEO-friendly solution, because it requires no changes to your URLs, and no other changes whatsoever to your site. The SE's won't know that anything has changed, except that they will see your new php-generated page content when requesting index.html."

That seems logical. Do you know of any reason why it isn't so?

Thank you.


Raeba
0 Replies
 
Craven de Kere
 
  2  
Fri 18 Feb, 2005 05:57 pm
I don't think I've ever said that I don't care what others have to say about it.

The downsides to the method you described is that the rewrite overhead is always there.

Whether or not the advantages outweigh the disadvantages is something that each webmaster would need to evaluate in each case.

I think the best way I can help you is to just stick to the pros and cons, as what's best for you is something I think you need to decide.
0 Replies
 
JatApp
 
  -1  
Wed 25 Aug, 2021 05:52 am
Your way of telling everything in this article is truly pleasant, every one be capable of easily be aware of it, Thanks a lot.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Convert Site from HTML to PHP
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/24/2024 at 05:50:10