2015-04-17 1671 views
0

第一次使用IIS服務器。在服務器上安裝wordpress。問題是網站無法在沒有index.php的url中工作。如何從iis windows服務器的網址中刪除Index.php

嘗試從stackoverflow。這樣做後顯示錯誤500。我的webconfig文件

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <defaultDocument enabled="true"> 
     <files> 
     <clear /> 
     <add value="index.aspx" /> 
     <add value="index.asp" /> 
     <add value="index.htm" /> 
       <add value="index.php" /> 
     <add value="index.html" /> 
     <add value="home.aspx" /> 
     <add value="home.asp" /> 
     <add value="home.htm" /> 
     <add value="home.html" /> 
     <add value="default.aspx" /> 
     <add value="default.asp" /> 
     <add value="default.htm" /> 
     <add value="default.html" /> 
     </files> 
    </defaultDocument> 
<directoryBrowse enabled="true" /> 
    </system.webServer> 
</configuration> 

也試圖與你的web.config這

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
<defaultDocument> 
    <!-- Set the default document --> 
     <files> 
     <remove value="index.php" /> 
     <add value="index.php" /> 
     </files> 
    </defaultDocument> 
     <httpErrors errorMode="Detailed"/> 
    <rewrite> 
     <rules> 
      <rule name="wordpress" patternSyntax="Wildcard"> 
       <match url="*" /> 
        <conditions> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        </conditions> 
       <action type="Rewrite" url="index.php" /> 
      </rule> 
     </rules> 
    </rewrite> 
</system.webServer> 
</configuration> 

回答

0

嘗試使用此改變。

<?xml version="1.0" encoding="UTF-8"?> 
    <configuration> 
    <system.web> 
     <customErrors mode="Off" /> 
     <compilation debug="true" /> 
    </system.web> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="Imported Rule 1" stopProcessing="true"> 
        <match url="^(.*)$" ignoreCase="false" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{R:1}" pattern="\.(gif|jpe?g|png)$" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="/index.php/{R:1}" /> 
       </rule> 
      </rules> 
     </rewrite> 
    <security> 
      <requestFiltering allowDoubleEscaping="true" /> 
    </security> 
    </system.webServer> 
</configuration> 
相關問題