Welcome to WebmasterWorld Guest from 54.160.221.82

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

301 Redirect with PHP and google.

     
2:51 pm on Mar 30, 2008 (gmt 0)

New User

5+ Year Member

joined:Mar 20, 2008
posts: 21
votes: 0


Newbie here....

I want to redirect some old pages from my old site to my new site... I do not wanna use modrewrite. So, i used PHP and I am gonna put the above code on my HEADER include file.

Is this how it is done using PHP? and would the search engines see that the page is being redirected with a 301? would this signal to search engine to remove the old INDEXED page url and replace it with the new url?


### REMOVE AFTER SIX MONTHS
$arrivingUrl = getenv('REQUEST_URI');
if (substr($arrivingUrl, 0, 7) == "/crafts"){
if ($arrivingUrl == "/crafts.html")
header("Location: http://example.com/artsandcrafts.html", true, 301);
else
if ($arrivingUrl == "/crafts/scrapbooking.html")
header("Location: http://example.com/artsandcrafts/papercraft.html", true, 301);
else
header("Location: http://example.com", true, 301);
}

[edited by: dreamcatcher at 6:26 pm (utc) on Mar. 30, 2008]
[edit reason] Use example.com, thanks. [/edit]

4:50 pm on Mar 30, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


it is something like that, but check the actual "Location" syntax against the PHP manual to be sure.

And yes, it would signal to re-index the new URL and de-index the old one.