IIS重定向规则未捕获指定的正则
我正在尝试为我们的IIS服务器配置重定向规则。
我已经检查了网站上的所有文档以及其他几个示例,但是当模式匹配时,我似乎无法获取请求的URL来捕获。我尝试测试IIS规则编辑器内部的正则表达式,并表明它正确匹配。我还设置了一些条件并对其进行了测试,但是它似乎也行不通。
这是XML
<rule name="product_detail.asp redirect to aspx" stopProcessing="true">
<match url="http:\/\/ten\.perle\.com\/products\/product_detail.asp\?(.*)&(.*)&(.*)" />
<conditions>
<add input="{QUERY_STRING}" pattern="http:\/\/ten\.perle\.com\/products\/product_detail.asp\?(.*)&(.*)&(.*)" />
</conditions>
<action type="Redirect" url="products/product_detail.aspx?{C:1}&{C:2}&{C:3}" appendQueryString="false" />
</rule>
示例url htttp:htttp:htttp: ///ten.perle.com/products/product_detail.asp?a=2& = 08000514&amp; c = 1650
我不明白我到底做错了什么,看起来我的回音看起来好像是我的regex应该抓住请求但是由于某种原因,它似乎从未如此。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我觉得您的URL规则似乎存在一些问题。
您可以尝试修改规则并查看其是否有效。
此外,您可以使用失败的请求跟踪在IIS中进行故障排除。
failedreqlogfiles
文件夹中的日志文件可以查看整个重写的整个过程,并可以检查匹配失败的位置。I feel like there seems to be some problem with your URL rule.
You can try to modify your rule and see if it works.
In addition, You can use Failed Request Tracing in IIS to troubleshoot. The log file in the
FailedReqLogFiles
folder can see the whole process of rewriting in detail, and can check where the match fails.因此,使用以下规则解决了该问题
,我想包括一些我想包含的东西,以防其他人面临类似的问题。有些事情要澄清。
顺便说一句
希望这可以帮助其他一些希望这样做的初学者,并阐明IIS重定向的更多不太明显的方面。
So the Issue was solved using the below rule
Some things That I would like to include in case anyone else faces a similar issue. Some things to clarify.
also btw was working on IIS v10.0
Hope this helps some other beginners looking to do this and clarify some more of the less obvious aspects of IIS redirects.