帮助中心 Help Center

VPS.Sh Help Center

分享一下Emlog在IIS7下静态化规则

分类 web应用 浏览(2883)


经过自己反复测试,和热心朋友的帮助,终于将emlog在IIS7下实现完美伪静态。

测试环境:Windows2008 R2+ IIS7.5 + IIS URL Rewrite 2.0

 IIS URL Rewrite 2.0下载地址:http://www.iis.net/downloads/microsoft/url-rewrite

请将以下规则放到网站根目录web.config中即可,我测试的emlog版本是5.3,之前的版本没试过。

     <rewrite>
      <rules>
                <rule name="Imported Rule 1">
                    <match url="^(post|record|sort|author|page)-([0-9]+)\.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="/index.php?{R:1}={R:2}" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^tag/(.+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?tag={R:1}" />
                </rule>
                <rule name="Imported Rule 3">
                    <match url="^page/([0-9]+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?page={R:1}" />
                </rule>
                <rule name="Imported Rule 4">
                    <match url="^sort/([0-9]+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?sort={R:1}" />
                </rule>
                <rule name="Imported Rule 5">
                    <match url="^record/(.+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?record={R:1}" />
                </rule>
                <rule name="Imported Rule 6">
                    <match url="^author/(.+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?author={R:1}" />
                </rule>
                <rule name="Imported Rule 6>
                    <match url="^sort/([0-9]+)/page/([_0-9a-z-]+)" />
                    <action type="Rewrite" url="/index.php?sort={R:1}&amp;page={R:2}" />
                </rule>
      </rules>
    </rewrite>



标签: Rewrite IIS7 emlog

评论:

ZeroBlog
2014-12-26 12:27
语法有错误。