首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建重写规则以将来自两个地址POST请求重定向到“Microsoft IIS10中的http://localhost/anpr/”?

如何创建重写规则以将来自两个地址POST请求重定向到“Microsoft IIS10中的http://localhost/anpr/”?
EN

Stack Overflow用户
提问于 2021-03-08 23:18:31
回答 1查看 43关注 0票数 0

我想将两个POST请求从大华ANPR相机重定向到Microsoft IIS中的一个脚本。我想将POST请求从"http://localhost/NotificationInfo/KeepAlive“和"http://localhost/NotificationInfo/TollgateInfo”重定向到"http://localhost/anpr/"“。我已经在主配置文件”C:\inetpub\wwwroot\web.config“中创建了规则:

代码语言:javascript
复制
<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/"?你能帮我吗?“

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-09 15:22:01

您的url有一些问题,您可以尝试以下规则:

代码语言:javascript
复制
  <rule name="test" stopProcessing="true">
      <match url="^NotificationInfo/(.*)$" />
      <action type="Redirect" url="http://localhost/anpr" />
  </rule>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66532382

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档