301 redirect using PHP header

by THavamani 2014-03-12 16:02:44

Sometimes you will modify current url . After modifying current url you have to redirect your visitors to a new URL address.
we can do it by 301 redirection.
Here is piece of code to do 301 redirection using php header.

Ex:
old url:http://timezoneguide.com/airports-timediff-Canada-Alberta-Calgary/United+Arab+Emirates-Abu+Dhabi-Abu+Dhabi.html

new url:http://timezoneguide.com/airports-timediff-Canada_Alberta_Calgary-UnitedArabEmirates_AbuDhabi_AbuDhabi.html

301 Redirect to new url


if(url=="http://timezoneguide.com/airports-timediff-Canada-Alberta-Calgary/United+Arab+Emirates-Abu+Dhabi-Abu+Dhabi.html")
{
header("HTTP/1.1 301 Moved Permanently");
header("Location:http://timezoneguide.com/airports-timediff-Canada_Alberta_Calgary-UnitedArabEmirates_AbuDhabi_AbuDhabi.html");
exit();
}


it is the most search engine friendly
1114
like
0
dislike
0
mail
flag

You must LOGIN to add comments