We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

tylerhall on 04/16/07


Tagged

redirect google 301


Versions (?)


Who likes this?

16 people have marked this snippet as a favorite

damarev
basicmagic
mafro
hudge
vali29
willcodeforfood
skywalker
bioascii
ledzep
digiloper
ibomb
romanos
Juego
pixelhandler
chph
blackabee


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.