【问题标题】:My rewrite rule give me a 500. What is wrong?我的重写规则给了我 500。怎么了?
【发布时间】:2014-05-31 00:41:41
【问题描述】:

当我向 Web.config 添加新规则时,我收到 HTTP 500 错误。我在 Azure 上。

以下给出错误消息:

<rule name="Rewrite ticket and segment" stopProcessing="true">
    <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/([0-9]{1,5})\/?" />
    <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}&segment={R:2}" />
</rule>

但是这个工作

<rule name="Rewrite ticket" stopProcessing="true">
    <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/?" />
    <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}" />
</rule>

【问题讨论】:

    标签: xml web-config


    【解决方案1】:

    原因是,您的XML 无效。由于web.config 是基于XML&amp;amp;,所以不是你想的那样。

    &amp;amp;改成&amp;amp;就可以了。

    <rule name="Rewrite ticket and segment" stopProcessing="true">
        <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/([0-9]{1,5})\/?" />
        <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}&amp;segment={R:2}" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 2019-12-17
      • 1970-01-01
      • 2016-05-17
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 2016-06-21
      • 2017-09-29
      • 1970-01-01
      相关资源
      最近更新 更多