我有这些旧网址:
/site/index?cat=likes&top=today
/site/index?cat=likes&top=month
/tag/TagName/index?cat=likes&top=today我把cat=likes改成了cat=popular
现在我得到了404,如何将所有电话从cat=likes重定向到cat=popular?
注意:,我已经重定向了,它美化了。
/site/index?cat=popular&top=today
已经被重定向到
/popular-today
发布于 2013-07-15 10:13:00
检查GET变量cat是否设置为‘site/index’,您可以在您的site/index或tag/tagName中检查这一点。之后,您可以使用PHP的header()重定向。就像这样:
public function actionIndex()
{
if ($_GET['cat'] == 'likes')
{
header('Location: /site/index?cat=popular', false, 301);
}
...
}您也可以使用您美化的URL。
public function actionIndex()
{
if ($_GET['cat'] == 'likes')
{
header('Location: /popular-today', false, 301);
}
...
}https://stackoverflow.com/questions/17636472
复制相似问题