[英]My rewrite rule give me a 500. What is wrong?
When I add a new rule to Web.config I get a HTTP 500 error. 将新规则添加到Web.config时,出现HTTP 500错误。 I'm on Azure.
我在Azure上。
The following give an error message: 以下给出错误信息:
<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>
but this one it working : 但这一工作 :
<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>
The Reason is, you have invalid XML
. 原因是,您的
XML
无效。 Since web.config
is XML
based &
is not that what you think. 由于
web.config
是基于XML
的&
所以您就不会这么想了。
Change the &
to &
将
&
更改为&
and it will work. 它会工作。
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.