PHP 301 Redirects

The preferred way of redirecting a page that has moved is by a 301 redirect. In PHP, 301 redirects are not the default (a 302 redirect is the default). Whenever you move a visitor to a new location, you should use the PHP 301 redirect, which involves one extra line of code.

In PHP, a 302 redirect is done as follows...
header('location: http://www.example.com/new-page.php');


By doing a 302 redirect, this will move the visitor from the old page to the new page, but any link or PR value will not follow the redirection. Usually, when you are moving a page, you want the old page to disappear and all links to point to the new page.
Digg StumbleUpon del.icio.us technorati blinklist furl reddit sphinn

Related Articles

Tags: 301 redirect 302 redirect 301 302 php redirect redirection url

Comments

Anil Kumar Singh - Sep 22, 2006

Is it spam when we are using meta redirect.

XTRaze - Jan 11, 2007

Is it SEO ?
Working fine.

jack - Mar 23, 2007

in the event of redirect www.old-domain.com to www.new-domain.com with the php 301 redirect is it needed in that php file to note in there permanantly moved or does the search engine not even see anything in that file?
newbie question

Post Comment

Post Comment

*
*


Visual CAPTCHA

*
Code is not case-sensitive
*

We welcome comments on this article, provided they have something to contribute. Please note that all links will be created using the nofollow attribute. This is a spam free zone. HTML is stripped from comments, but BBCode is allowed.