解决IIS7 稻壳doccms伪静态问题


 最近租用win版香港虚拟主机用户,在装稻壳doccms时,发现页面除了首页,其他页面都打不开了,应该是伪静态问题,检查后确实这个原因。

但该程序只有提供httpd.ini和.htaccess脚本,也就是说,只支持linux和windows2003的IIS6版的伪静态插件,现在目前主机win2003服务器已经很稀少了,几乎绝迹,况且微软停止了技术支持。

目前市面上大多win2008和win2012起,IIS版本是iis7以上

这边把脚本转换成了web.config后,适用于IIS7以上版本,并提供给大家下载,以下是伪静态代码,将rewrite部分加入到web.config对应位置即可。

<rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url=".*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/(config|content|editor|keditor|inc|setup|skins|temp|upload|xml)(/|)$" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url=".*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/(admini|config|content|editor|keditor|inc|setup|skins|temp|xml)/(.*)[^\.(js|css|gif|jpg|jpeg|png|swf|html|mp3)]$" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
                <rule name="Imported Rule 4" stopProcessing="true">
                    <match url=".*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/(config|content|skins|temp|upload)/.*\.(php|jsp|asp|aspx|cgi|sql|lock)$" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
                <rule name="Imported Rule 5" stopProcessing="true">
                    <match url=".*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/admini/(.+)[^index|login|html].*\.php$" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                </rule>
            </rules>
        </rewrite>

当然,又是为了方便大家,我已经把web.config准备好了一份,点击下载,传到web目录下即可。 点击下载web.config文档