Results 1 to 13 of 13
  1. #1
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    I asked this on the main board and have had no reply. This is probably a better place for the question.

    I recently changed some pages of my site over from .html to .php and I have a question.

    A lot of these pages are in the search results under the .html name and have good page rank, etc.

    What is the best way to forward the .html to the .php pages so when someone clicks on the .html results they got to the .php pages automatically? Also will the page rank carry over when I do that?
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  2. #2
    Newbie
    Join Date
    January 18th, 2005
    Posts
    36
    Michelle

    I'm afraid there is no easy way of making sure html pages will end up on its php version.

    Actually there is no way to do that, but what you can do is one configure your error pages to land your visitors to your main page until your new php pages are indexed.

    Or what you can do is change php extensions back to html pages and use .htaccess to treat html pages as php pages, this will allow you to use php code in your pages but one down side of this is it will put lots of load on your server.
    --------------------------------
    PHP & Mysql Support
    <a target="_blank" href="http://www.scriptresources.com/?abestweb">
    ScriptResources.com</a>

  3. #3
    Newbie
    Join Date
    January 18th, 2005
    Posts
    36
    there is one more way if you don't have too many pages

    you can add to the existing html pages.

    &lt;META HTTP-EQUIV="refresh" CONTENT="0; URL=phppage.php"&gt;
    --------------------------------
    PHP & Mysql Support
    <a target="_blank" href="http://www.scriptresources.com/?abestweb">
    ScriptResources.com</a>

  4. #4
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    Thanks guys!

    I actually have been using the meta refresh method for now, but I just wasn't sure if there was a better way to do it.

    my .html pages that I am concered about had great page rank, but the .php versions are half what they .html page rank is. Hopefully the .php pages will catch up.
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  5. #5
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Server redirect is probably what your looking for here.

    Something like:

    <pre class="ip-ubbcode-code-pre">RewriteEngine on
    RewriteRule (.*)\.html $1.php [L]</pre>

    If you have .htaccess or direct access to the server config file you can probably use server redirects.
    Lead, Follow or Get Out of the Way!

  6. #6
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    Budda,

    Will regular .html page still work if I do that?

    I only have a handful of the pages ending in .php, but my main page is one of them.
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  7. #7
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Since it sounds like you still have other html files something like this might be better:

    <pre class="ip-ubbcode-code-pre">RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*)\.html $1.php [L]</pre>

    This one test to see if the file exist and redirects nonexisting filenames.
    Lead, Follow or Get Out of the Way!

  8. #8
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Buddha:
    Since it sounds like you still have other html files something like this might be better:

    <pre class="ip-ubbcode-code-pre">RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*)\.html $1.php [L]</pre>

    This one test to see if the file exist and redirects nonexisting filenames. <HR></BLOCKQUOTE>

    Ok, and I just add this to my .htaccess file?

    If my server does not support ModRewrite, could I add this to the .htaccess if I wanted to just redirect my main page?

    DirectoryIndex index.php

    Would that work? It would only redirect the index.html at the root to index.php as long as I upload the .htaccess to the root, right?
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  9. #9
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by ~ Michelle:
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Buddha:
    Since it sounds like you still have other html files something like this might be better:

    <pre class="ip-ubbcode-code-pre">RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*)\.html $1.php [L]</pre>

    This one test to see if the file exist and redirects nonexisting filenames. <HR></BLOCKQUOTE>

    Ok, and I just add this to my .htaccess file? <HR></BLOCKQUOTE>Yep. I have no idea weather this will work on your server...but it should work on Apache.
    Lead, Follow or Get Out of the Way!

  10. #10
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    Ok, if I try to use the modrewrite I get an error when trying to access my site


    Do you think the DirectoryIndex index.php will work for what I want it to do?
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  11. #11
    Web Ho - Design B!tch ~Michelle's Avatar
    Join Date
    January 18th, 2005
    Location
    Michigan
    Posts
    2,040
    Update!

    I just added

    DirectoryIndex index.php index.html

    to my .htaccess file and it appears to have done the trick AND brought my page rank along with it! (which is a bit lower since page rank updated last night and I was using a redirect, but the next rank update should fix that)

    This looks like a fix.

    Thanks for the help!
    ~Michelle
    "All I ask is a chance to prove that money can't make me happy."
    "Work to become, not to acquire." -- Confucius

  12. #12
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by ~ Michelle:
    Ok, if I try to use the modrewrite I get an error when trying to access my site


    Do you think the DirectoryIndex index.php will work for what I want it to do? <HR></BLOCKQUOTE>Not if you have lots of them. DirectoryIndex only effects your index file, nothing else.

    You might want to contact your host and see if he can do something. You maybe on a Windows server or maybe your host isn't allowing you to use Modrewrite. Modrewrite can be extremely danagerous in the wrong hands on a shared server.

    I don't think the META redirects are a good idea. The SE's may take offense at all those redirects and treat them as spam.

    [ yep proof once again not to listen to Buddha! ]
    Lead, Follow or Get Out of the Way!

  13. #13
    Full Member
    Join Date
    January 18th, 2005
    Posts
    88
    If you are on a windows server, you can use
    "404" trick to "Server.Transfer" the new destination. It is a bit risky. You have been warned. It is just a temporary make over.

    For Linux, Apache mod-rewrite is the best option. As Buddha told, "Modrewrite can be extremely danagerous in the wrong hands on a shared server."


    IMHO, if your top level domain (www.your-domain.com) has a good PR, there is no need to worry about the PR for individual pages. Google will rank them in due course.

  14. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  2. Can someone help with this PHP question.
    By Derrick Kinsey in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: March 22nd, 2007, 07:23 PM
  3. Php question
    By zimmy in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: September 16th, 2006, 10:26 PM
  4. PHP Question
    By mopek in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: August 23rd, 2006, 04:51 PM
  5. PHP Question
    By Doug247 in forum Programming / Datafeeds / Tools
    Replies: 1
    Last Post: March 31st, 2004, 10:20 AM

Posting Permissions

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