【发布时间】:2014-03-24 21:03:06
【问题描述】:
长期读者第一次海报。
我已经阅读了类似帖子上的 100 条感觉,试图让它适合我想要做的事情。
抱歉,如果它被覆盖。我相信我的代码是正确的,但它可能与其他代码冲突?
我有旧 ASP 购物车中的旧 URL,并希望 301 重定向到新的磁电机静态页面。 这些 URL 只有 5 个,因此不需要批量操作。
示例:
旧网址:http://test.com.au/shopcontent.asp?type=FAQ%20and%20Terms 新网址:http://test.com.au/privacy-policy-cookie-restriction-mode
我知道通过阅读其他帖子你不能简单地使用:
Redirect 301 /shopcontent.asp?type=FAQ%20and%20Terms /privacy-policy-cookie-restriction-mode
所以我认为这应该可行:
RewriteCond %{QUERY_STRING} ^type=FAQ%20and%20Terms$ [NC]
RewriteRule ^shopcontent\.asp$ /privacy-policy-cookie-restriction-mode/? [NC,R=301,L]
我也尝试过删除空格的 %20,如下所示:
RewriteCond %{QUERY_STRING} ^type=FAQ\ and\ Terms$ [NC]
RewriteRule ^shopcontent\.asp$ /privacy-policy-cookie-restriction-mode/? [NC,R=301,L]
当我尝试访问旧 URL 时,它只是转到 404 页面。我正在使用 Magento 附带的标准 .htaccess 文件(如果有帮助,我可以发布);
我正在使用启用了 mod 重写的 VPS。我还有其他用于非动态 URL 的重定向 301。
有没有我可以查看的日志?
感谢任何帮助或建议。
谢谢鲁迪
ps。我发现这篇文章让我到达了现在的位置
RewriteCond %{QUERY_STRING} in mod_rewrite (dynamic to static URL) not working
【问题讨论】:
标签: php .htaccess magento mod-rewrite redirect