【发布时间】:2010-03-07 18:07:41
【问题描述】:
我使用 .htaccess 重定向 301 重定向一个 URL,然后将所有查询字符串元素附加到末尾,留下一些在 Google 中索引为 /store/product/?d=department&s=section&p=product 的 URL。
我已经通过使用RewriteRule 修复了重定向,而不是附加查询字符串,但是我被困在尝试将带有查询字符串的旧重定向 URL 重写回原始 URL(因为这些正在寻找现在就像两个不同的 Google 网址)。
我已经设法让RewriteRule 进行某种工作,因为/store/product/xxxxx 应该重定向到/store/product/,但它似乎不适用于整个查询字符串。
我一直用的是:
RewriteRule ^store/product/([a-zA-Z0-9\-_\?=&]+)$ http://www.example.com/store/product/ [NC,R=301,L]
或
RewriteRule ^store/product/\?d=department&s=section&p=product$ http://www.example.com/store/product/ [NC,R=301,L]
希望一切都有意义!
非常感谢
【问题讨论】:
标签: apache mod-rewrite