【发布时间】:2013-01-12 04:40:18
【问题描述】:
在我的网站中,我为 SEO 提供了一个虚拟 URL。我的链接如下所示
http://legacy.com/project/491/women-tops-long-red-bangalore
在这个 URL women-tops-long-red-bangalore 中,这个措辞是虚拟的,基于页面正在加载的项目 id(491)。在 491/{whatever you will give it will work}之后。
为此我想重定向页面。如果有人给了
http://legacy.com/project/491/{any}
想要重定向到
http://legacy.com/project/491/women-tops-long-red-bangalore
我给出了下面的代码
if(isset($_GET['item_id']))
{
Header("HTTP/1.1 301 Moved Permanently" );
Header("Location: http://".$_SERVER['HTTP_HOST'].$project_link);
}
在 $project_link 中,我正在调用一个函数,它将根据项目 id 返回一个字符串,如下所示
"/project/491/women-tops-long-red-bangalore"
但它显示错误“页面未正确重定向”但网址正在更改
【问题讨论】:
-
您的新 URL 也会在
http://legacy.com/project/491/{any}下,并且会再次重定向,不是吗?您应该检查 URL 是否是那个,而不是再次重定向。 -
不,如果我给legacy.com/project/491/women url 更改legacy.com/project/491/women-tops-long-red-bangalore 这样但它显示错误,它不会重定向
-
它不会去任何地方,因为您处于重定向循环中。我猜你正在Firefox中尝试这个?在Chrome中打开相同的url,错误信息会更明显
-
在 chrome 中出现错误“此网页有重定向循环”
-
是的,那个重定向循环是什么意思,我该如何解决它
标签: php seo smarty http-redirect