我想将包含字符串:'/ Secured /'的所有URL请求转发回站点的主页。
原因是我在IIS 7.5中实现第三方Web程序,我需要关闭某些页面,将用户转发到另一个地址或自定义错误页面。
我决定尝试将“请求过滤”/ denyUrlSequences与“错误页面”结合使用,因为我无法编辑第三方应用程序。
阻塞似乎有效,并且相应的请求转发到404.5页面,其中包含以下2个字符串以及更多:
“请求过滤模块配置为拒绝URL序列”“为Web服务器配置了请求过滤,并且URL序列被拒绝。”
当我尝试使用“错误页面”覆盖404.5页面时,我似乎无法覆盖传递的错误页面。 我甚至进入了custerr目录来编辑404-5.htm,但IIS没有使用此页面,文本是不同的。
有没有更好的办法?
I want to forward all URL requests containing the string: '/Secured/' back to the home page of the site.
The reason is that I am implementing a 3rd party web program in IIS 7.5 and I need to turn off certain Pages, forwarding the user to another address or custom error page.
I decided to try "Request Filtering"/denyUrlSequences in combination with "Error Pages", as I cannot edit the 3rd party application.
The blocking seems to work and the appropriate requests forward to a 404.5 page with the following 2 strings and more:
"The request filtering module is configured to deny the URL sequence" "Request filtering is configured for the Web server and the URL sequence is being denied."
When I try to then use "Error Pages" to override the 404.5 page, I cannot seem to override the error page delivered. I even went into the custerr directory to edit the 404-5.htm, but this page is not being used by IIS, the text is DIFFERENT.
Is there a better way?
最满意答案
我发现“URL Rewrite”可用于阻止URL模式,并且还可以将检测到的URL模式转发到您想要的位置。
http://www.iis.net/downloads/microsoft/url-rewrite
安装此功能后,您可能需要重新启动才能在IIS管理区域中查看它。
单击图标并添加“请求阻止”规则。
我使用了通配符匹配并将*/Secured/*指定为“Pattern(URL Path)”。 我不需要指定*/Secured*因为模式总是包含一个尾部斜杠(我希望)。 我保存然后编辑了规则。 当我编辑规则时,在规则的底部,我可以使用Redirect。
我测试了模式,并按预期重定向!
I discovered that "URL Rewrite" can be used to block URL patterns, and ALSO forward the detected URL Pattern where you want to go.
http://www.iis.net/downloads/microsoft/url-rewrite
After you intstall this feature, you may need to reboot to see it in your IIS Admin area.
Click on the icon and add a rule for "Request Blocking".
I used wildcard matching and specified */Secured/* as the "Pattern (URL Path)". I did not need to specify */Secured* because the pattern will always contain a trailing slash (I hope). I saved and then edited the rule. When I edit the rule, at the bottom of the rule I was able to use Redirect.
I tested the pattern and it redirected as expected!
更多推荐
page,页面,URL,IIS,电脑培训,计算机培训,IT培训"/> <meta name="description&q
发布评论