Windows server2012 R2下IIS8.5伪静态规则 DZ论坛为例

网站根目录创建web.config文件,复制下面代码即可。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="已导入的规则 1">
                    <match url="^(.*)/topic-(.+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/portal\.php\?mod=topic&amp;topic={R:2}&amp;{R:4}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 2">
                    <match url="^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/portal\.php\?mod=view&amp;aid={R:2}&amp;page={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 3">
                    <match url="^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/forum\.php\?mod=forumdisplay&amp;fid={R:2}&amp;page={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 4">
                    <match url="^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/forum\.php\?mod=viewthread&amp;tid={R:2}&amp;extra=page\%3D{R:4}&amp;page={R:3}&amp;{R:6}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 5">
                    <match url="^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/forum\.php\?mod=group&amp;fid={R:2}&amp;page={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 6">
                    <match url="^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/home\.php\?mod=space&amp;{R:2}={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 7">
                    <match url="^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/home\.php\?mod=space&amp;uid={R:2}&amp;do=blog&amp;id={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 8">
                    <match url="^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}/index\.php\?action={R:2}&amp;value={R:3}&amp;{R:5}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 9">
                    <match url="^topic-(.+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="portal.php?mod=topic&amp;topic={R:1}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 10">
                    <match url="^article-([0-9]+)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="portal.php?mod=view&amp;aid={R:1}&amp;page={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 11">
                    <match url="^forum-(\w+)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="forum.php?mod=forumdisplay&amp;fid={R:1}&amp;page={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 12">
                    <match url="^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="forum.php?mod=viewthread&amp;tid={R:1}&amp;extra=page\%3D{R:3}&amp;page={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 13">
                    <match url="^group-([0-9]+)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="forum.php?mod=group&amp;fid={R:1}&amp;page={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 14">
                    <match url="^space-(username|uid)-(.+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="home.php?mod=space&amp;{R:1}={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 15">
                    <match url="^blog-([0-9]+)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="home.php?mod=space&amp;uid={R:1}&amp;do=blog&amp;id={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
                <rule name="已导入的规则 16">
                    <match url="^archiver/(fid|tid)-([0-9]+)\.html$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="archiver/index.php?action={R:1}&amp;value={R:2}&amp;{C:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>