301 Redirect Google Safe


 / Published in: PHP
 

This redirects visitors to a new URL using a 301 redirect. Using a 301 redirect is the safest way to let Google know your address has changed.

  1. header("HTTP/1.1 301 Moved Permanently");
  2. header("Location: http://www.newdomain.com/somepage.html");

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: tylerhall on April 16, 2007

It might also be wise to add a "exit();" afterwards just in case the browser doesn't behave.

You need to login to post a comment.