我想将两个POST请求从大华ANPR相机重定向到Microsoft IIS中的一个脚本。我想将POST请求从"http://localhost/NotificationInfo/KeepAlive“和"http://localhost/NotificationInfo/TollgateInfo”重定向到"http://localhost/anpr/"“。我已经在主配置文件”C:\inetpub\wwwroot\web.config“中创建了规则:
<rules>
<rule name="NotificationInfo/TollgateInfo" patternSyntax="ECMAScript">
<match url="(.*)/NotificationInfo/TollgateInfo" ignoreCase="false" />
<action type="Rewrite" url="{R:1}/anpr/" appendQueryString="false" logRewrittenUrl="true" />
</rule>
<rule name="NotificationInfo/KeepAlive">
<match url="(.*)/NotificationInfo/KeepAlive$" />
<action type="Rewrite" url="{R:1}/anpr/" logRewrittenUrl="true" />
</rule>
<rule name="NotificationInfo/TollgateInfo/" patternSyntax="ECMAScript">
<match url="(.*)/NotificationInfo/TollgateInfo/" ignoreCase="false" />
<action type="Rewrite" url="{R:1}/anpr/" appendQueryString="false" logRewrittenUrl="true" />
</rule>
<rule name="NotificationInfo/KeepAlive/">
<match url="(.*)/NotificationInfo/KeepAlive/$" />
<action type="Rewrite" url="{R:1}/anpr/" logRewrittenUrl="true" />
</rule>
</rules>IIS10对于"http://localhost/NotificationInfo/KeepAlive“和"http://localhost/NotificationInfo/TollgateInfo"”返回错误"HTTP 404.0 - Not Found“。Address "http://localhost/anpr/”起作用。"anpr“是一个带有脚本"index.php”的文件夹。我做错了什么?如何做这样的重定向?如何做重写规则,从"http://localhost/NotificationInfo/KeepAlive“和"http://localhost/NotificationInfo/TollgateInfo”重定向到"http://localhost/anpr/"?你能帮我吗?“
发布于 2021-03-09 15:22:01
您的url有一些问题,您可以尝试以下规则:
<rule name="test" stopProcessing="true">
<match url="^NotificationInfo/(.*)$" />
<action type="Redirect" url="http://localhost/anpr" />
</rule>

https://stackoverflow.com/questions/66532382
复制相似问题