0

我已经将一个网站从 php 重建为 ASP.NET,并且需要将所有旧的可怕页面 URL 重定向到新网站的根目录 - 旧网站只使用 index.php 和 print.php 然后加载查询字符串值 - 所以我有以下规则

RewriteRule ^print.php$ http://www.mynewsite.co.uk [R=301,L]
RewriteRule ^index.php$ http://www.mynewsite.co.uk [R=301,L]

我遇到的问题是 301 重定向但将所有糟糕的查询字符串附加到域的末尾 - 例如

http://www.mynewsite.co.uk?crap=45&more&7698097987 etc...

如何告诉 ISAPI 不要使用 Querystrings 而只是重定向到根 URL?

4

1 回答 1

2

规则应该是这样的:

RewriteRule ^print.php$ http://www.mynewsite.co.uk? [R=301,L]
RewriteRule ^index.php$ http://www.mynewsite.co.uk? [R=301,L]

注意“?” 在替换结束时。

于 2010-02-25T11:30:27.407 回答