PHP Header Redirect Questions

3 replies
Was a question..
#header #php #questions #redirect
  • Profile picture of the author kokopelli
    Not sure I understand you correctly, but it is important to use the correct HTTP status code when redirecting an old to new page. In my understanding, you have to use a 301 redirect to maintain the PR (maybe 302 will also work, not 100% sure).

    I normally use a WordPress plugin for redirects, or add it directly to the .htaccess file.

    If you use a PHP redirect, it should look something like this:
    Code:
    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.new-url.com" );
    ?>
    You can test your redirection here: Search Engine Friendly Redirect Checker

    Apologies if I misunderstood your question ...
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5231817].message }}
  • Profile picture of the author SteveJohnson
    If the Big G sees a 301 redirect, it will eventually update its index and transfer some or all of the 'juice' the original URL had (someone claiming to know exactly how much, if any, gets transferred isn't being honest). A 302 - temporary - means that eventually the content will return to the original URL, and Google will know to keep looking there for it.

    Your phrase 'need to redirect to where the content has been moved to' holds the key. The content has been moved to a new URL - redirect with a 301.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[5235342].message }}
  • Profile picture of the author Terry Crim
    Thank you Steve for your response. Yours and Kokopelli's response helped me understand this better.

    Thanks
    {{ DiscussionBoard.errors[5246777].message }}

Trending Topics