易企cms在windows2008 2012 iis7伪静态规则方法

由于这套cms过于老旧停更好多年了,官方伪静态帮助说明只提供了iis6 的windows2003环境下的伪静态说明,而对于更新的windows2012  2016 ,甚至2008不好支持。

情况一:如果您空间根目录没有web.config文件

这边整理了一下支持windows2008 2012 的iis7.5以上的伪静态脚本,将以下代码拷贝进txt记事本文件后,存成文档后,然后改名成web.config,ftp上传放置到网站根目录下即可。

 

情况二:如果您网站已经存在web.config文件

只需将两个<rewrite>代码部分(包含<rewrite>),插入到web.config里的;两个<system.webserver>代码之间。

下面有两份代码片段,使用任意一份即可

web.config代码片段1

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="已导入的规则 1" stopProcessing="true">

<match url="^a_(.+)\.html$" 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="article.php?name={R:1}" appendQueryString="false" />

</rule>

<rule name="已导入的规则 2" stopProcessing="true">

<match url="^p_(.+)\.html$" ignoreCase="false" />

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

</rule>

<rule name="已导入的规则 3" stopProcessing="true">

<match url="^ca_([^/_]+)[/]?$" ignoreCase="false" />

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

</rule>

<rule name="已导入的规则 4" stopProcessing="true">

<match url="^ca_([^/]+)_([0-9]+)[/]?$" ignoreCase="false" />

<action type="Rewrite" url="category.php?name={R:1}&amp;p={R:2}" appendQueryString="false" />

</rule>

<rule name="已导入的规则 5" stopProcessing="true">

<match url="^comment.html$" ignoreCase="false" />

<action type="Rewrite" url="comment.php" />

</rule>

<rule name="已导入的规则 6" stopProcessing="true">

<match url="^sitemap.xml$" ignoreCase="false" />

<action type="Rewrite" url="sitemap.php" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

web.config代码片段2

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <rewrite>

            <rules>

                <rule name="Imported Rule 1">

                    <match url="article/(.+)\.html$" ignoreCase="false" />

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

                </rule>

                <rule name="Imported Rule 2">

                    <match url="product/(.+)\.html$" ignoreCase="false" />

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

                </rule>

                <rule name="Imported Rule 3">

                    <match url="category/([^/_]+)[/]?$" ignoreCase="false" />

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

                </rule>

                <rule name="Imported Rule 4">

                    <match url="category/([^/]+)_([0-9]+)[/]?$" ignoreCase="false" />

                    <action type="Rewrite" url="category.php?name={R:1}&amp;p={R:2}" appendQueryString="false" />

                </rule>

                <rule name="Imported Rule 5">

                    <match url="catalog/([^/]+)[/]?$" ignoreCase="false" />

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

                </rule>

                <rule name="Imported Rule 6">

                    <match url="comment\.html$" ignoreCase="false" />

                    <action type="Rewrite" url="comment.php" />

                </rule>

                <rule name="Imported Rule 7">

                    <match url="sitemap\.xml$" ignoreCase="false" />

                    <action type="Rewrite" url="sitemap.php" />

                </rule>

            </rules>

        </rewrite>

    </system.webServer>

</configuration>
 
分享到
表个态吧 赞(0)