我正在 Azure 上部署站点,并且正在尝试为该站点编写重写规则。
我有以下代码,它可以工作:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Sendy all" stopProcessing="true">
<match url="^(.+?)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
<rule name="Sendy all" stopProcessing="true">
<match url="^api/(.+?)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但是当我在规则标签中添加以下代码时,我收到错误消息The page cannot be displayed because an internal server error has occurred
。为什么?
<rule name="Sendy all" stopProcessing="true">
<match url="^api/(.+?)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>