2016-04-03 18 views
0

Burada Azure ile kullanmak üzere bir web.config dosyasına dönüştürmem gereken bir .htaccess dosyası var. İşte htaccess dosyasıdır:. Azure için web.config dosyasına dönüştürme.

Options +FollowSymlinks 
Options -Multiviews 
ErrorDocument 404 /error-404 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [NC,L] 

Zaten bir web.config dosyasına bu şekilde dönüştürülmüş, ancak çalışmıyor. Sadece bir 404 hatası atar. İşte 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> 

Bu dosya ile ilgili her şey yeniden yazma dışında çalışır. Azure'da .php dosya uzantısı olmadan sayfaların gösterilmesini sağlamanız için yardıma ihtiyacınız var.

cevap

0

ErrorDocument 404 /error-404 için lütfen aşağıya bakın.

<system.webServer> 
    <httpErrors> 
     <remove statusCode="404" /> 
     <error statusCode="404" path="/error-404" responseMode="ExecuteURL"/> 
    </httpErrors> 
</system.webServer> 

URL'yi yeniden yazmak için lütfen aşağıya bakın.

<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="rule 1C" stopProcessing="true"> 
        <match url="!.*\.php$" /> 
         <conditions logicalGrouping="MatchAll"> 
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
         </conditions> 
        <action type="Rewrite" url="{R:1}.php" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration>