iis下常用程序的偽靜態規則列表(包括wordpress、thinkphp)

發佈時間:2014-12-23

shopex discuz2.0 discuz2.5 discuz3.x 淘寶客 ecshop phpwind參照http://www.west.cn/faq/list.asp?unid=797通過主機面板設置即可

wordpress設置(系統不推薦Windows,如果可以更換為linux系統運行更穩定):

第一步:

 登陸wordpress後台,設置--固定鏈接--自定義結構,選擇設置下URL格式。

第二步:

新建一個文件命名為:web.config,在裡面寫入以下規則,上傳到wwwroot目錄。

<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
   <system.webServer>
     <rewrite>
       <rules>
         <rule name="URL" stopProcessing="true">
          <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>

Thinkphp偽靜態規則:

 手工創建web.config文件到站點根目錄

<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
     <system.webServer>
       <rewrite>
         <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
              <match url=".*\.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv)" />
             <action type="Rewrite" url="{R:0}" />
           </rule>
            <rule name="Imported Rule 2">
             <match url="/httpd(?:\.ini|\.parse\.errors)" />
              <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
            </rule>
           <rule name="Imported Rule 3" stopProcessing="true">
              <match url="^(?!/index.php)(?!/admin.php)(.*)$" ignoreCase="false" />
              <conditions logicalGrouping="MatchAll">
              <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>
   </system.webServer>
</configuration>