开发者

send users to another page if landed on wrong one

I rewrote my search url from this

domain.com/search.php?q=query&search=1

to

domain.com/search.php?q=query&select=all 

"query = search term". How can I send someone to the select=all page if they landed on search=1? I have a ton of google links with search=1 and am trying to reroute users and at the same time get google to remove the parameter and index select=all. This is what I am doing right now and it sends peopl开发者_JAVA百科e to the homepage if they land on a search=1 and I don't like doing that.

if (empty($_GET['select']))
header("Location: http://domain.com/");

Does anyone have any suggestions? thanks.


if (!isset($_GET['select']))
{
    header("Location: http:///search.php?q=".$_GET['q']."&select=all");
}

EDIT
By the way, if you need to remove a URL from Google's index, you can submit it at https://www.google.com/webmasters/tools/removals?pli=1

Also, you can submit your new url to the Google index at http://www.google.com/addurl/?continue=/addurl


if(empty($_GET['select')){
    header ('HTTP/1.1 301 Moved Permanently');
    header ('Location: http://domain.com'.$_SERVER['PHP_SELF'].'?q='.$_GET['q'].'&select=all');
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜