春天的樹

IIS7/IIS8偽靜態(tài)規(guī)則修正

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
        <system.webServer>
                <rewrite>
                        <rules>
                                <rule name="Rule 1" stopProcessing="true">
                                        <match url="^index\.php$" ignoreCase="false" />
                                        <action type="None" />
                                </rule>
                                <rule name="Rule 2" stopProcessing="true">
                                        <match url="/(.*)" 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?rewrite={R:1}" appendQueryString="false" />
                                </rule>
                        </rules>
                </rewrite>
        </system.webServer>
</configuration>


#1樓
發(fā)帖時(shí)間:2014-1-30   |   查看數(shù):0   |   回復(fù)數(shù):4
春天的樹

上面是官方原版的規(guī)則,我測(cè)試了一下,發(fā)現(xiàn)IIS7.5下出錯(cuò)。最終所有內(nèi)頁都是404


經(jīng)過研究后發(fā)現(xiàn)是多了兩個(gè)/  找到現(xiàn)豐的這兩行。把url后面的/ 刪除就可以了。
<match url="/(.*)" ignoreCase="false" />

<action type="Rewrite" url="/index.php?rewrite={R:1}" appendQueryString="false" />
效果如下
<match url="(.*)" ignoreCase="false" />

<action type="Rewrite" url="index.php?rewrite={R:1}" appendQueryString="false" />

歡迎交流QQ:331315679
2014-1-30 #2樓
dwjx007
2014-4-16 #3樓
bxfa
正在找這個(gè)呢
2014-5-9 #4樓
bychris
看了下新版后臺(tái)可以直接生成最新的規(guī)則哇。測(cè)試了無錯(cuò)誤呢。
2015-11-30 #5樓
游客組