0
我在這裏有一個.htaccess文件,我需要將其轉換爲用於Azure的web.config。這裏是htaccess文件:將.htacess轉換爲適用於Azure的web.config
Options +FollowSymlinks
Options -Multiviews
ErrorDocument 404 /error-404
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [NC,L]
我已經將其轉換爲web.config文件,但它不起作用。它只是拋出404錯誤未找到。這裏是web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule 1C" stopProcessing="true">
<match url="!.*\.php$" ignoreCase="true" />
<action type="Rewrite" url="/%{REQUEST_FILENAME}.php". />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<add value="test.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
有關此文件的一切工作,除了重寫。只需要幫助讓頁面在Azure中沒有.php文件擴展名的情況下顯示即可。