homepage Welcome to WebmasterWorld Guest from 54.205.236.46
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
301 Redirect with PHP and google.
rudyten




msg:3614725
 2:51 pm on Mar 30, 2008 (gmt 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]

 

g1smd




msg:3614803
 4:50 pm on Mar 30, 2008 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved