如何设定ecshop为伪静态(URL Rewrite URL重写)?
 

1. 登入后台,点选 商店设置 » 基本设置
2. 在" URL重写"栏目下,选择"简单重写",其他选项使用默认配置,再点“确定”如下图:
设置伪静态









3. 最后,将最下面的代码保存为web.config文件放到网站根目录下,设定完成。

备注:设置完上面步骤后,有时候会发现首页导航栏并没有生成伪静态,这个关系到源码的问题,ecshop本身没做完整,在自定义提交导航时没有做URL处理,所以需要到后台手动更新这些导航的地址。 
登录到后台》在右边的菜单》系统设置》自定义导航栏,然后点“编辑”图标并修改地址。 如图:
导航栏伪静态











更改导航栏地址











如:category.php?id=6 修改为:category-6.html

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="1" stopProcessing="true">
    <match url="^index\.html$" ignoreCase="true" />
    <action type="Rewrite" url="index.php" />
    </rule>
    <rule name="2" stopProcessing="true">
    <match url="^category$" ignoreCase="false" />
    <action type="Rewrite" url="index.php" />
    </rule>
    <!--# access any object by its numeric identifier-->
    <rule name="3" stopProcessing="true">
    <match url="^feed-c([0-9]+)\.xml$" ignoreCase="false" />
    <action type="Rewrite" url="feed.php?cat={R:1}" appendQueryString="false" />
    </rule>
    <rule name="4" stopProcessing="true">
    <match url="^feed-b([0-9]+)\.xml$" ignoreCase="false" />
    <action type="Rewrite" url="feed.php?brand={R:1}" appendQueryString="false" />
    </rule>
    <rule name="5" stopProcessing="true">
    <match url="^feed-type([^-]+)\.xml$" ignoreCase="false" />
    <action type="Rewrite" url="feed.php?type={R:1}" appendQueryString="false" />
    </rule>
    <rule name="6" stopProcessing="true">
    <match url="^feed\.xml$" ignoreCase="false" />
    <action type="Rewrite" url="feed.php" />
    </rule>
    <rule name="7" stopProcessing="true">
    <match url="^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}&amp;brand={R:2}&amp;price_min={R:3}&amp;price_max={R:4}&amp;filter_attr={R:5}&amp;page={R:6}&amp;sort={R:7}&amp;order={R:8}" appendQueryString="true" />
    </rule>
    <rule name="8" stopProcessing="true">
    <match url="^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}&amp;brand={R:2}&amp;price_min={R:3}&amp;price_max={R:4}&amp;filter_attr={R:5}" appendQueryString="true" />
    </rule>
    <rule name="9" stopProcessing="true">
    <match url="^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}&amp;brand={R:2}&amp;page={R:3}&amp;sort={R:4}&amp;order={R:5}" appendQueryString="true" />
    </rule>
    <rule name="10" stopProcessing="true">
    <match url="^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}&amp;brand={R:2}&amp;page={R:3}" appendQueryString="true" />
    </rule>
    <rule name="11" stopProcessing="true">
    <match url="^category-([0-9]+)-b([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}&amp;brand={R:2}" appendQueryString="true" />
    </rule>
    <rule name="12" stopProcessing="true">
    <match url="^category-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="category.php?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="13" stopProcessing="true">
    <match url="^goods-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="goods.php?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="14" stopProcessing="true">
    <match url="^article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="article_cat.php?id={R:1}&amp;page={R:2}&amp;sort={R:3}&amp;order={R:4}" appendQueryString="true" />
    </rule>
    <rule name="15" stopProcessing="true">
    <match url="^article_cat-([0-9]+)-([0-9]+)-(.+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="article_cat.php?id={R:1}&amp;page={R:2}&amp;keywords={R:3}" appendQueryString="true" />
    </rule>
    <rule name="16" stopProcessing="true">
    <match url="^article_cat-([0-9]+)-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="article_cat.php?id={R:1}&amp;page={R:2}" appendQueryString="true" />
    </rule>
    <rule name="17" stopProcessing="true">
    <match url="^article_cat-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="article_cat.php?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="18" stopProcessing="true">
    <match url="^article-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="article.php?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="19" stopProcessing="true">
    <match url="^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" ignoreCase="false" />
    <action type="Rewrite" url="brand.php?id={R:1}&amp;cat={R:2}&amp;page={R:3}&amp;sort={R:4}&amp;order={R:5}" appendQueryString="true" />
    </rule>
    <rule name="20" stopProcessing="true">
    <match url="^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" ignoreCase="false" />
    <action type="Rewrite" url="brand.php?id={R:1}&amp;cat={R:2}&amp;page={R:3}" appendQueryString="true" />
    </rule>
    <rule name="21" stopProcessing="true">
    <match url="^brand-([0-9]+)-c([0-9]+)(.*)\.html" ignoreCase="false" />
    <action type="Rewrite" url="brand.php?id={R:1}&amp;cat={R:2}" appendQueryString="true" />
    </rule>
    <rule name="22" stopProcessing="true">
    <match url="^brand-([0-9]+)(.*)\.html" ignoreCase="false" />
    <action type="Rewrite" url="brand.php\?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="23" stopProcessing="true">
    <match url="^tag-(.*)\.html" ignoreCase="false" />
    <action type="Rewrite" url="search.php\?keywords={R:1}" appendQueryString="true" />
    </rule>
    <rule name="24" stopProcessing="true">
    <match url="^snatch-([0-9]+)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="snatch.php?id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="25" stopProcessing="true">
    <match url="^group_buy-([0-9]+)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="group_buy.php?act=view&amp;id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="26" stopProcessing="true">
    <match url="^auction-([0-9]+)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="auction.php?act=view&amp;id={R:1}" appendQueryString="true" />
    </rule>
    <rule name="27" stopProcessing="true">
    <match url="^exchange-id([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="exchange.php\?id={R:1}&amp;act=view" appendQueryString="true" />
    </rule>
    <rule name="28" stopProcessing="true">
    <match url="^exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="exchange.php\?cat_id={R:1}&amp;integral_min={R:2}&amp;integral_max={R:3}&amp;page={R:4}&amp;sort={R:5}&amp;order={R:6}" appendQueryString="true" />
    </rule>
    <rule name="29" stopProcessing="true">
    <match url="^exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="exchange.php\?cat_id={R:1}&amp;page={R:2}&amp;sort={R:3}&amp;order={R:4}" appendQueryString="true" />
    </rule>
    <rule name="30" stopProcessing="true">
    <match url="^exchange-([0-9]+)-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="exchange.php\?cat_id={R:1}&amp;page={R:2}" appendQueryString="true" />
    </rule>
    <rule name="31" stopProcessing="true">
    <match url="^exchange-([0-9]+)(.*)\.html$" ignoreCase="false" />
    <action type="Rewrite" url="exchange.php\?cat_id={R:1}" appendQueryString="true" />
    </rule>
    </rules>

    </rewrite>
    </system.webServer>
    </configuration>