.htaccess动态网址(旧网站)到magento中的静态网址

时间:2014-02-23 10:01:51

标签: php .htaccess magento mod-rewrite redirect

长时间读者第一次发布海报。

我已经阅读过类似帖子中的100个感觉,试图让它适合我想做的事情。

道歉是否已被涵盖。我相信我有正确的代码,但它可能与其他东西相冲突?

我从旧的ASP购物车中获取旧网址,并希望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]

当我尝试访问旧网址时,它只会转到404页面。我正在使用Magento附带的标准.htaccess文件(如果有帮助我可以发帖);

我正在使用一个启用了mod重写的VPS。对于非动态URL,我有其他Redirect 301。

我能查看哪些日志?

感谢任何帮助或建议。

谢谢Rudi

PS。我发现这篇帖子让我到了现在的位置

RewriteCond %{QUERY_STRING} in mod_rewrite (dynamic to static URL) not working

1 个答案:

答案 0 :(得分:0)

您无法使用此规则:

RewriteEngine On

RewriteCond %{QUERY_STRING} "^type=FAQ\%20and\%20Terms$" [NC]
RewriteRule ^shopcontent\.asp$ /privacy-policy-cookie-restriction-mode/? [NC,R=301,L]