PHP Tutorial : 301 Redirect Permanently Moved

Ever Moved a page to a new one and searched for a way to let your users and search engines spiders / robots to let they know that you moved that page permanently? There are a lot of ways to do it, but with php is so simple. Just two lines of code. Here is the code:

<?php

Header( "HTTP/1.1 301 Moved Permanently" );

Header( "Location: the-new-page.html" );
?>
This entry was posted in Basic PHP and tagged , , , , , , , . Bookmark the permalink.

2 Responses to PHP Tutorial : 301 Redirect Permanently Moved

  1. Cosmin says:

    is there any difference between this and .htaccess, from a search engine’s point of view? poti sa imi dai reply si in romana :)

  2. admin says:

    I wont reply in romanian because it’s an english blog and I want to keep things like that.
    The difference between this php 301 and .htaccess one is null, it is exactly the same thing in front of the search engine.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>