Tôi đang triển khai trang web trên Azure và tôi đang cố viết các quy tắc viết lại cho trang web.Tại sao tôi nhận được 500 khi tôi thêm quy tắc viết lại vào Web.config của mình trong Azure?
Tôi có đoạn code sau, và nó hoạt động:
<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>
nhưng khi tôi thêm đoạn mã sau bên trong thẻ quy tắc tôi nhận được thông báo lỗi The page cannot be displayed because an internal server error has occurred
. Tại sao?
<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>
Tôi nghĩ bạn nên định dạng lại câu hỏi của mình. Tôi không thể biết bạn đang thêm quy tắc gì. Cái thứ ba giống với cái thứ hai mà bạn làm việc. Tất cả ba quy tắc (hai bản sao) đều có cùng tên. Tôi khuyên bạn nên đăng một phiên bản hoạt động và một phiên bản không hoạt động. –