2013-02-19 91 views
1

我目前在我的服務器根目錄下有一個正在運行的wordpress安裝,但現在我要爲子文件夾「new-site」添加另一個WordPress站點。在IIS服務器上安裝第二個Wordpress

這是一個IIS服務器,所以web.config文件中應該有這樣的根目錄,根據WordPress的:

<configuration> 
    <system.webServer> 
     <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> 

我現在面臨的問題:如何修改根的web.config文件(下面),以便在/ new-site中的WP安裝正常工作。 (它在我的本地主機上運行良好,我更改了wp-options中的URL。新網站上的主頁看起來不錯,但如果你點擊任何鏈接,它將成爲根網站的錯誤頁面。)謝謝!

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <security> 
      <requestFiltering> 
       <requestLimits maxAllowedContentLength="4294967295" /> 
      </requestFiltering> 
     </security> 

     <rewrite> 
      <rules> 
       <rule name="Main Rule" stopProcessing="true"> 
        <match url=".*" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="index.php" /> 
       </rule> 
       <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> 

     <defaultDocument> 
      <files> 
       <clear /> 
       <add value="index.php" /> 
       <add value="index.html" /> 
       <add value="Default.htm" /> 
       <add value="Default.asp" /> 
       <add value="index.htm" /> 
       <add value="aboutus.html" /> 
      </files> 
     </defaultDocument> 

     <handlers> 
      <remove name="PHP53_via_FastCGI" /> 
      <remove name="AboMapperCustom-1045478" /> 
      <add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" requireAccess="Script" /> 
     </handlers> 
    </system.webServer> 
</configuration> 

回答

4

已解決。在子文件夾的web.config中,添加<clear />,這樣它就不會受到根的規則的影響。

<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <clear /> 
       <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> 

來源:http://forums.iis.net/post/1883731.aspx

+0

能否請您發表您的最終webconfig根應用程序和子目錄都。我一直得到500.19的錯誤,並嘗試各種組合,但目前爲止沒有運氣! – Raj 2016-06-01 07:27:13

相關問題