|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi...I apologize if this topic has already come up; I could not find the EXACT condition I am facing.
I'd like to change my home page from a standard HTML to a PHP. (I am not changing domain names). In order to not disturb other sites linking to me, I'd like to change my existing index.html to only redirect to the new index.php page. Which is the best and safest way to do this without having Google/Yahoo/MSN think my old page has disappeared (and subsequently be placed in the big sandbox in the sky)? I ONLY have a PR 2; I don't want to lose that! Thanks! |
|
|||
|
I don't know if this will affect your rankings but you can use JavaScript in your HTML page to send users to your PHP page.
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- window.location="http://www.yourdomain.com/"; // --> </script> |
|
|||
|
Adamwlad:
I did some more checking and found an html version as well as your javascript example. The only problem I read was the redirect won't work if the user does not have javascript enabled. The information I found made no mention of the effects on Google/Yahoo/MSN... |
|
|||
|
I strongly advise against using a JavaScript redirect. Using a JavaScript redirect can be a kiss of death with Google. It resembles a JavaScript cloaking technique used by a Las Vegas SEO company a few years ago. Google banned all of the company's clients' sites that used this technique.
Also, most search engines cannot follow JavaScript redirects. It's the same issue with most JavaScript menu systems. The real question is, why do you want to change from HTML to PHP? If you just want to change from a static page site to a dynamic site, and you are on an Apache server that allows you to use the .htaccess file, you can add a command to the file that will execute HTML pages as if they were PHP scripts. Just add the following to the .htaccess file found in the root directory. AddType application/x-httpd-php .html You can then leave the .html extensions on your Web pages and not risk starting over with the search engines. This sends an .html page through the PHP parser and executes the code just like if it was a PHP script. There are other alternatives, but this is probably the simplest way to do it. I assume you are talking about turning more than just the home page into a PHP script. If you just want to use a PHP script for the home page only, you could change all of the links within the site to an absolute link that does not use the home page file name. http://www.mydomainname.com/ If a search engine does not find a link such as index.php or index.html, it lets the server use the default page and the recognized home page URL becomes http://www.mydomainname.com/. You do not need to add index.html or index.php to a home page URL. Hope this helps.
__________________
Facts are meaningless. They can be used to prove anything. - Homer Simpson MySQL Cheatsheet :: Arizona SEO training |
|
||||
|
The proper way is using the .htaccess.
Rather than instructing it to parse .htm as .php you can redirect it for the search engines as well as site visitors and existing links using the 301 redirect. Here's the code: redirect 301 /index.html http://www.domainname.com/index.php
__________________
Ron Boyd website consulting (design, optimization, marketing) :: Follow Me: @orionsweb |
|
||||
|
It might be a primitive method but I have done this a few times.
If you only want to change the home page just create a duplicate of your home page and change the extension to .php then ensure links on you sites go to index.php not index.html. Change the header of index.html to include a refresh/redirect to index.php If you are using Cpanel you probably have the server redirects option so instead of changing the header of index.html you can simply set up a redirect on the server to redirct index.html traffic to index.php
__________________
http://carsalesasia.com http://deep-field-relaxation.com http://motorcycleasia.net etc |
|
||||
|
This is the way I do it. I put these two lines in my .htaccess file:
Code:
AddType application/x-httpd-php htm html php AddHandler application/x-httpd-php .htm .html Oh, and I might add that if you decide to add php includes on other pages you won't need to worry about changing any of the page name/file extensions, they'll all work. So it's not an index page fix, it's a sitewide fix. |
|
|||
|
WOW! A lot of great responses! All my sub-pages are already .php but did not think in the beginning I would ever need mysql on my home page. I recently had bad reviews on my home page (my very-first web site) and wanted to brighten it up with new products, featured products, etc. And by also adding randomizing code, I would have zero maintenance.
My biggest fear was to tamper with my already-low PR with Google. Based on the great comments, it appears the .htaccess file method is the way to go. (I assume this file already exists on my root directory?) Thank you ALL very much for your help! JR-getmea |
|
||||
|
If there is no .htaccess file you can simply create one in your cpanel filemanager or use notepad and upload it. Some webhosts make you use the filemanager in cpanel (or plesk) to upload the .htaccess file for security reasons instead of allowing ftp of it, so if you find you can't ftp it, try the filemanager for your webhosting.
|
|
|||
|
As a web developer and search engine marketer, my take on this issue is this.
- you run the risk of loosing your PR and will have to start all over - or run the risk of your PHP page being considered as just a duplicate of your former html page - the use of the htaccess command RewriteRule ^yourfilename.php$ yourfilename.html should solve the problem. What will happen in a few months or years later if you decide to change the server-side programming language, say from PHP to ColdFusion or ASP? Would you have to change your file extensions from .php to .cfm or .asp? If your server allow you to ahve an htaccess file the use it without even having to need a redirect 301 On the other hand if your web host does not permit the use of the htaccess file, then take your business elsewhere. Hope this modest contribution will be useful to ALL.
__________________
Please read the Forum Rules about signature links. |
|
||||
|
Quote:
|
|
|||
|
Qote:
I should think it would be the other way around, holyhttp. :) Thanks for your input bj. The original question was migrating from static page html to php hence changing the file extension from html to php. Following the same logic say, now going from php to asp would be to change the old extension to the new one. Isn't it? Using html extensions thanks to the htaccess now allows us to make the file naming independent of the server-side programming language used. Oh well, thanks ALL for your great contribution. I have been a spectator for quite a while and now decide to get really involved and share my insights.
__________________
Please read the Forum Rules about signature links. |
|
|||
|
It's totaly stupid you use (and many more as well) index.html in their linking!!!
http://www.domain.com is all you need! No http://www.domain.com/index.html it's so stupid, you literally create 2 duplicate pages http://www.domain.com/index.html http://www.domain.com/ as they display the same result. Simply always use: http://www.domain.com/ and you will be fine - be it asp, php, whatever:) |
|
|||
|
TechEvangelist and BJ are correct - use the .htaccess file to tell your server to process php within .htm/.html files - no need for any change of URLs.
|
|
|||
|
Quote:
Quote:
Quote:
__________________
Pete Clark Got any spare time? Anything you need? Barter in Spain at http://BarterWithBart.com |
|
||||
|
Quote:
I think if you do that you won't ever give that advice again. |
|
|||
|
anyone know if Google will ban your site from their results if you use the META tag redirect?
|
|
||||
|
Quote:
|
|
||||
|
Quote:
|
|
|||
|
Quote:
It's what I sugggested, and what increddy suggested as well, I would be interested to know why you think that it is wrong.
__________________
Pete Clark Got any spare time? Anything you need? Barter in Spain at http://BarterWithBart.com |
|
||||
|
No, Jaan, that is NOT it at all. I had at one point done just what getmea is doing-- I added a php include on my index page and changed the extension and thought it would be fine.
IT WASN'T. My traffic plummeted, and I was out of google. They DO index you by your filename, whether it says so or not. A friend instituted this fix for me, the one I suggested above, I put the file extension back to the original, and within a week all was right in my world again. So you can all believe what you will, but I know from experience. |
|
||||
|
BJ I agree if the website has been set up using a relative link to the home then yes they will index your home page by file name. I said that above already. Of course if you are doing this you should stop and fix this problem like I said. The SE should not know about your server default doc for your home page at all. If so your internal linking is not correct and it should be fixed.
Now if they don't know about the server default doc for the home page changing its name and extensions should not make a difference. Obviously this is not true for everyone because many website incorrectly link to the home page in relative format. Sorry for the confusion this is all I was saying. |
|
||||
|
Jaan, maybe you should try to change your homepage extension and see what happens . . .
|
|
||||
|
Google has not indexed my home page, they have indexed my domain name only because I am linking to the domain name not /index.html
http://www.google.com/search?hl=en&l...tm&btnG=Search http://www.google.com/search?hl=en&l...om&btnG=Search If I changed my home page extension it would not make a difference. Can you please show me evidence of " They DO index you by your filename, whether it says so or not." to back up this statement from a website that is using correct home page linking to the root domain and not the relative server default document? |
|
|||
|
Wow! Such a simple issue generated so many opinions.
Quote:
Given that all of the internal links in this site are already PHP, the simplest solution is to just to remove all link references to the home page file name itself. This concentrates all external and internal links on a single version of the home page URL. In this case, the page could just be renamed to index.php, or the addition to the .htaccess file could be used so that the current HTML home page is parsed as PHP. The 301 redirect will also work, but it's not needed unless you intend to use the file name in links to the home page.
__________________
Facts are meaningless. They can be used to prove anything. - Homer Simpson MySQL Cheatsheet :: Arizona SEO training |
|
||||
|
There is a better way using the .htaccess file. Don't redirect! Simply have it treat the HTML pages as PHP:
AddType application/x-httpd-php .htm .html Each HTML page will not have to be changed to PHP. The HTML pages will allow the PHP scripts to work. If you change your pages from .html to .php, you will be hurt in the SERPs. There is no reason to endure that.
__________________
DrTandem's San Diego Web Page Design, drtandem.com |
|
|||
|
I got this from the recent SES session. I think it was the bot obedience session, when the Google rep said that meta refresh of 0 seconds is treated as 301 redirect. If I remember it correctly, other SE reps there also agreed (Yahoo & ASK).
|
|
||||
|
Quote:
__________________
DrTandem's San Diego Web Page Design, drtandem.com |
|
|||
|
So...have we decided that I should leave my home page name (index.html) as-is and also change the HTaccess file?
I will also verify all my sub-pages' back links to my home page are not using a relative address. Thanks again... |
|
||||
|
That is what I would do, but the decision is ultimately up to you. Also please seek out as many opinions on this as possible and don't rely on one forum thread only to guide decisions like this. Remember forums help you self educate, but they shouldn't ultimately guide your business decisions.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |