IIS 7.5 url 重写帮助 - 奇怪的查询字符串
我有一个入站链接,其中有很多垃圾。我的网站仅加载主页并忽略查询字符串,但我想检测查询字符串并重定向到干净的主页网址。
网址如下所示:
http://www.mysite.url/?c%253E'dmjdlgsbve%253E2'lfzxpset%253E'sbol%253E2'f%253E'vsm%253Eiuuq%253B00xxx%252 Fopdmjdlz%252Fdpn0'gffe%253Eopqbz'qsjdf%253E'tbq%253Ebd7g8g73cc3c7d%253Af5925f3efd2f62dcd'zbsht%253Exxx%252Fopdmjdlz%252Fdpn
我似乎无法制定一条规则来捕获此查询字符串并让我重定向到 http://www.mysite.url。有什么想法吗?
I have an inbound link that has a lot of garbage in it. My site just loads the home page and ignores the querystring, but I'd like to detect the querystring and redirect to a clean home url.
The url looks like this:
http://www.mysite.url/?c%253E'dmjdlgsbve%253E2'lfzxpset%253E'sbol%253E2'f%253E'vsm%253Eiuuq%253B00xxx%252Fopdmjdlz%252Fdpn0'gffe%253Eopqbz'qsjdf%253E'tbq%253Ebd7g8g73cc3c7d%253Af5925f3efd2f62dcd'zbsht%253Exxx%252Fopdmjdlz%252Fdpn
I can't seem to make a rule that catches this querystring and let me redirect to http://www.mysite.url. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很容易做到。首先,您必须确保您位于主页(即空请求 URL),然后检查条件中是否有非空查询字符串。如果两者都是这种情况,您将永久重定向回相同的 URL(= 没有查询字符串的 URI)。
喜欢:
如果您愿意,您可以添加更具体的条件,使其仅匹配此特定的入站链接。
更新:
我怀疑您的 URL 中存在双重 URL 编码。例如,%253E 可能会被替换为 %3E,因为 %25 是百分号 URL 编码。 %3E 是 >字符 URL 编码。所以我认为你会更幸运:
It's pretty easy to do. First of all you have to make sure you are on the homepage (i.e. empty request URL) and then you check for a non empty query string in the conditions. If both are the case, you do a permanent redirect back to the same URL (= URI without query string).
Like:
If you want you could add a more specific condition to let it only match this specific inbound link.
UPDATE:
I suspect that there is some double URL encoding going on in your URL. For example, %253E is probably ment to be %3E as %25 is the percentage sign URL encoded. And %3E is the > character URL encoded. So I think you will have more luck with this: