IIS 8.5 偽靜態去掉index.php thinkphp 3.2.2


因為測試都是在win下開發的 win8.1企業版

II8.5 首先安裝  Thinkphp 3.2.2 

URL Rewrite Module 2.0

http://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads

上面地址選擇 合適的版本下載安裝

安裝完成后 關閉IIS 在重新打開

在你建立的網站根目錄有 web.config 這個文件

輸入偽靜態規則

<rewrite>
 <rules>
 <rule name="OrgPage" stopProcessing="true">
 <match url="^(.*)$" />
 <conditions logicalGrouping="MatchAll">
 <add input="{HTTP_HOST}" pattern="^(.*)$" />
 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 </conditions>
 <action type="Rewrite" url="index.php/{R:1}" />
 </rule>
 </rules>
 </rewrite>

具體位置參考下我的

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <add value="index.php" />
            </files>

        </defaultDocument>
         <rewrite>
             <rules>
             <rule name="OrgPage" stopProcessing="true">
             <match url="^(.*)$" />
             <conditions logicalGrouping="MatchAll">
             <add input="{HTTP_HOST}" pattern="^(.*)$" />
             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
             </conditions>
             <action type="Rewrite" url="index.php/{R:1}" />
             </rule>
             </rules>
             </rewrite>

    </system.webServer>


</configuration>

然后訪問以前帶index.php/控制器/方法 的鏈接 去掉index.php看看

這個index.php對於JS來說 很不好 用uploadify上傳后台地址用U函數生成index.php就很不好  總出錯

其他的一到后台地址 有index.php總是出錯 

偽靜態規則還是不懂 等先做出來慢慢研究下

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM