Go Back   Dynamic Drive Forums > General Coding > PHP
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-29-2007, 12:49 AM
kuau's Avatar
kuau kuau is offline
Senior Coders
 
Join Date: Sep 2007
Location: Maui
Posts: 380
Thanks: 154
Thanked 12 Times in 12 Posts
Default Does using .php adversely affect your page rank?

I inherited a website last July that was all done in frames and images (ie. text was actually a photo of text), but the file extensions were .html. There were no meta-tags, no page titles, and the only pages that had real text were the home page (a few sentences) and about-us page. Nevertheless, the site had a page-rank of 3 (!). I rewrote the entire site using SEO-friendly practices (added meta-tags, used all real text, removed all tables and did everything in pure css using php includes, added a ton of content, used <h1> tags etc).

Because of Yahoo's hosting limitations (no .htaccess), I had to change all the file extensions to .php. I did redirects for all the html files in the only way I could without server access or an .htaccess file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HTTP/1.1 301 Moved Permanently</title>
<meta http-equiv="refresh" content="0;URL=http://www.sargentsfineart.com/index.php">
</head>
<body>
</body>
</html>

After all that effort, you would think the page rank would have gone way up, but instead it went down to 2!!

So my question is, do the Google search engines rank .html page extensions higher than .php file extensions? Or do they assume that .php means that the file is all code and just skip them? Or how do you explain the drop in the page rank? It is very discouraging to say the least. I figure if anyone would know, it would be you guys, so please elucidate this for me.

Thanks very much. erin

PS. In case this is a factor, I should mention that I created all the pages (except the homepage, about us etc) as dynamic pages loading the content data from a mySQL database into templates filled with php variables. But I was told that bots view the pages in their rendered states, just as a viewer would see them. I hope this is true. (?)
Reply With Quote
  #2  
Old 12-29-2007, 12:54 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

It is generally true, but doing redirects for the HTML pages in this way (without using the correct status code) probably means that the search engine still indexed them, and ranked the page lower thanks to all these contentless pages. You'd have been better off just deleting the pages. Also, <meta> redirects are not part of any standard and may be ignored entirely by the user agent, be it a browser or a search engine's spider: you must include a link to the page to which you're redirecting in the body of the HTML.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Reply With Quote
  #3  
Old 12-29-2007, 01:00 AM
kuau's Avatar
kuau kuau is offline
Senior Coders
 
Join Date: Sep 2007
Location: Maui
Posts: 380
Thanks: 154
Thanked 12 Times in 12 Posts
Default

I did delete the original pages and replaced them with those lame redirects. What would a proper redirect look like?
Reply With Quote
  #4  
Old 12-29-2007, 01:40 AM
kuau's Avatar
kuau kuau is offline
Senior Coders
 
Join Date: Sep 2007
Location: Maui
Posts: 380
Thanks: 154
Thanked 12 Times in 12 Posts
Default

Last month I moved the site to a hosting company that allows .htaccess files, so I can now change the filenames back to .html extensions, but am not sure if it is worth the effort. Does anyone there know anyhting about SEO? Would this make any difference to the page ranking? And if I changed the file extensions, what is the best way to notify the search engines of the name change? I don't want to lose what ranking already exists.

I would really appreciate some guidance in this area. Mahalo, erin
Reply With Quote
  #5  
Old 12-29-2007, 01:49 AM
tech_support's Avatar
tech_support tech_support is offline
Modarator Man.
 
Join Date: May 2006
Location: Sydney, Australia - Near the coast.
Posts: 2,011
Thanks: 0
Thanked 8 Times in 7 Posts
Default

Nope. No search engine/person would actually CARE if your page is under a .html extension or .php

It might be a security risk putting your pages as .php, but "obscurity is no solution to security issues"
__________________
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)
Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
Reply With Quote
  #6  
Old 12-29-2007, 02:03 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

Quote:
I did delete the original pages and replaced them with those lame redirects. What would a proper redirect look like?
In PHP,
Code:
<?php header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . ($url = '/location/of/new/page.html')); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="refresh" content="0;URL=<?php echo $url; ?>">
    <title>Page Moved</title>
  </head>
  <body>
    <p>This page has been moved to <a href="<?php echo $url; ?>"><?php echo $url; ?></a>.</p>
  </body>
</html>
Quote:
It might be a security risk putting your pages as .php, but "obscurity is no solution to security issues"
It's also a performance issue, though. Probably worth it. You can do it more generally with .htaccess and mod_rewrite:
Code:
RewriteEngine on
RewriteRule .php$ .html [R]
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Reply With Quote
  #7  
Old 12-29-2007, 02:03 AM
kuau's Avatar
kuau kuau is offline
Senior Coders
 
Join Date: Sep 2007
Location: Maui
Posts: 380
Thanks: 154
Thanked 12 Times in 12 Posts
Default

Dear tech_support:

Thanks, but I'm a bit unsure of your answer. Are you saying that there is nothing to be gained from an SEO standpoint by my changing all the pages to .html? But are you also saying I should do it because using a php extension is a security risk? How is it a security risk?

And you really lost me with "obscurity is no solution to security issues." Admittedly I am just new to forums and am still trying to figure out what some of the initials stand for, but I feel like a total moron when I need every sentence translated. Is there some forum secret lingo page I need to read? Sorry if I am a bit dense here. Thanks, erin

Last edited by kuau; 12-29-2007 at 02:17 AM. Reason: to make it clear to which answer I was referring
Reply With Quote
  #8  
Old 12-29-2007, 02:25 AM
kuau's Avatar
kuau kuau is offline
Senior Coders
 
Join Date: Sep 2007
Location: Maui
Posts: 380
Thanks: 154
Thanked 12 Times in 12 Posts
Default

Dear Twey: Thank you so much for showing me the proper code. I read somewhere that after a certain length of time the search engines have updated their indexes so presumably you wouldn't need the redirects after a while. Do you know if that is true and how long it would take?

If I add this to the .htaccess file:

RewriteEngine on
RewriteRule .php$ .html [R]

does that mean I just leave all the files with the php extension? And, if I do it that way, is it just as good as manually changing the file extensions? Not sure what you meant by the performance issue comment... do .html files execute faster than .php files?

Thanks a million. Sorry for all the questions but I need to understand things thoroughly (yes, I drove my teachers nuts, but was valedictorian). erin
Reply With Quote
  #9  
Old 12-29-2007, 02:50 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

Quote:
does that mean I just leave all the files with the php extension?
No, that's for when you move all your .php files to .html to avoid the performance hit.
Quote:
do .html files execute faster than .php files?
Yes.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Reply With Quote
  #10  
Old 12-29-2007, 06:13 AM
tech_support's Avatar
tech_support tech_support is offline
Modarator Man.
 
Join Date: May 2006
Location: Sydney, Australia - Near the coast.
Posts: 2,011
Thanks: 0
Thanked 8 Times in 7 Posts
Default

Quote:
Quote:
do .html files execute faster than .php files?
Yes.
How is it faster?
__________________
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)
Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:41 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.