2015-04-29 199 views
1

我有以下web.config。我認爲我的這個沒什麼問題,但是我不能把它改寫成索引。我也試過url =「index.php」沒有領先/IIS忽略重寫規則

我的web.config有什麼問題嗎?或者是否還有其他可能是錯誤的(如IIS設置) - 如果是這樣,是否可以檢查而無需訪問服務器(除了FTP到頁面)?

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <configSections> 
     <sectionGroup name="system.webServer"> 
      <sectionGroup name="rewrite"> 
       <section name="rewriteMaps" overrideModeDefault="Allow" /> 
       <section name="rules" overrideModeDefault="Allow" /> 
      </sectionGroup> 
     </sectionGroup> 
    </configSections> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="NWCMS" stopProcessing="true"> 
        <match url=".*" /> 
        <action type="Rewrite" url="/index.php" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

回答

0

我想你想的index.php文件默認打開的時候沒有文件名的URL。試試這個:

<?xml version="1.0"?> 
    <configuration> 
     <system.webServer> 
      <defaultDocument enabled="true"> 
      <files>      
       <add value="index.php"/> 
      </files> 
      </defaultDocument> 
      <modules runAllManagedModulesForAllRequests="true"/> 
     </system.webServer> 
    </configuration>