Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Does using .php adversely affect your page rank?

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Because .html/.htm won't run through the PHP parser, whereas .php will. If you set .html to do so, then it would be just as slow. The extension does nothing except act as a label-- and the server does the rest. It just so happens that those labels are served differently.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #12
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    But it's still a PHP file... just hidden in the address bar.

    Quote Originally Posted by Twey
    Code:
    RewriteEngine on
    RewriteRule .php$ .html [R]
    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

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You're reading it the wrong way around. That redirect points all .php URLs to .html files -- for when Erin renames the files back.
    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!

  4. #14
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Twey:

    I just looked more closely at your rewrite of my redirect code and noticed that you used my same command line:
    Code:
    <meta http-equiv="refresh" content="0;URL=<?php echo $url; ?>">
    Perhaps you don't realize that that line causes an immediate redirect to the URL specified, which is why I put nothing between the body tags... because it never gets that far. So your version and my version have exactly the same result. Try it and you'll see. I don't think that is what you intended. (?)

    My intention was that anyone using an old bookmark with index.html would seamlessly arrive at index.php, and that is what happens. I just thought there was a more elegant method that did the redirect and at the same time informed the search engines that it was a permanent move (301). I just made that one up so figured it must be wrong.

    Is there some kind of hierarchy in Apache that causes it to give preferential treatment to certain file extensions? I can understand how a pure html file might be faster because it doesn't engage the php engine, but it seems odd that the very same file would execute faster just because of the .html extension, considering it does contain php. Is it a way of tricking Apache into moving php files higher up in the hierarchy?

    Mahalo, erin

  5. #15
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Perhaps you don't realize that that line causes an immediate redirect to the URL specified, which is why I put nothing between the body tags... because it never gets that far.
    Unless the browser doesn't support <meta> refreshes. In this case, it should be redirected via the HTTP Location header anyway, but it never hurts to have a link too. If you want to rely on the header (which is safer than relying on the <meta>) then all the HTML in that page is in fact superfluous.
    My intention was that anyone using an old bookmark with index.html would seamlessly arrive at index.php, and that is what happens. I just thought there was a more elegant method that did the redirect and at the same time informed the search engines that it was a permanent move (301). I just made that one up so figured it must be wrong.
    There is a more elegant method, and that's exactly what I did above, using PHP and/or .htaccess, at your convenience.
    Is there some kind of hierarchy in Apache that causes it to give preferential treatment to certain file extensions? I can understand how a pure html file might be faster because it doesn't engage the php engine, but it seems odd that the very same file would execute faster just because of the .html extension, considering it does contain php.
    If your file does actually contain PHP then the PHP won't work. I thought these were plain HTML files that you had renamed to .php in order to get consistent URLs.

    Edit: I see I was wrong. The following .htaccess file should help things along:
    Code:
    RewriteEngine on
    RewriteRule .html$ .php [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!

  6. #16
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Sorry, I thought I mentioned that I had to rename them .php to get the php to work because I couldn't use an .htaccess file on Yahoo. Literally every single file contains php includes and php variables. Most pages are dynamic & are assembled using php, variables, and data from a database. I use .htaccess on the new host to instruct the server to parse html files as php which is why I now have the option to use .html extensions.

    Under these circumstances, do you change your answers? Thanks, erin

  7. #17
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I did edit. Rather than parsing .html as PHP, redirect from a .html in the URL to a .php on the file.
    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!

  8. #18
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Twey:

    Here is my current .htaccess file:

    Code:
    Options +Includes
    RemoveHandler .html .htm
    AddType application/x-httpd-php .php .htm .html
    ErrorDocument 404 /html/404.html
    Are you saying I should change it to:

    Code:
    RewriteEngine on
    RewriteRule .html$ .php [R]
    ErrorDocument 404 /html/404.html
    If I use RewriteRule, how do search engines see the files -- as .php or .html? And would I do this so that the link to the files wouldn't be broken?

    Somehow I think my original question got lost in all this. I wanted to know if search engines ranked files with an .html extension higher than .php files. It was suggested that using .php was a security risk (still not sure why) and also that there was performance degradation, but that was when you thought we were comparing pure html to php files. I believe it was concluded that if the files contain php, regardless of the extension, there would be no difference in performance. That being the case, what would be the advantage of changing all the extensions from php to html? So now I'm back to my original question. Please clarify. Thanks, erin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •