【发布时间】:2018-07-11 13:52:56
【问题描述】:
我正在尝试清理一些返回 404 而不是 200 的请求。
例如有人有这样的链接到我的网站:
http://example.com/?publisher=123456
我正在尝试添加一个重写规则来处理这种情况:
<rule name="Redirect publisher" stopProcessing="true">
<match url="(.*)\/\?publisher=(.*)$" negate="false" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false"></conditions>
<action type="CustomResponse" statusCode="404" statusReason="Not Found" statusDescription="The requested URL was not found." />
</rule>
我关注了Microsoft instructions,但是,即使my test 显示上述正则表达式应该可以工作,但什么也没有发生。我尝试做一个更常见的重定向,像这样:
<action type="Redirect" url="https://{HTTP_HOST}" redirectType="Permanent" />
然而,又没有任何反应。好像我的正则表达式不好?
【问题讨论】:
标签: asp.net regex url-rewriting