当前位置:首页 > 建站经验 > 网页模板经验 > 正文内容

Discuz!X3 Windows系统 IIS 7 伪静态规则

xmwl2年前 (2022-07-08)网页模板经验757
将以下代码复制保存为 web.config,上传到网站根目录即可生效。
请注意:只适用与IIS7或以上版本,IIS6并不支持。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
  <rewrite>
   <rules>
    <rule name="portal_topic">
     <match url="^(.*/)*topic-(.+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/portal.php?mod=topic&topic={R:2}&{R:3}" />
    </rule>
    <rule name="portal_article">
     <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/portal.php?mod=view&aid={R:2}&page={R:3}&{R:4}" />
    </rule>
    <rule name="forum_forumdisplay">
     <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/forum.php?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}" />
    </rule>
    <rule name="forum_viewthread">
     <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/forum.php?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}" />
    </rule>
    <rule name="group_group">
     <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/forum.php?mod=group&fid={R:2}&page={R:3}&{R:4}" />
    </rule>
    <rule name="home_space">
     <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/home.php?mod=space&{R:2}={R:3}&{R:4}" />
    </rule>
    <rule name="home_blog">
     <match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/home.php?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}" />
    </rule>
    <rule name="forum_archiver">
     <match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/index.php?action={R:2}&value={R:3}&{R:4}" />
    </rule>
    <rule name="plugin">
     <match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$" />
     <action type="Rewrite" url="{R:1}/plugin.php?id={R:2}:{R:3}&{R:4}" />
    </rule>
   </rules>
  </rewrite>
</system.webServer>
</configuration>

IIS7 Web Server(独立主机用户)

<rewrite>
        <rules>
                <rule name="portal_topic">
                        <match url="^(.*/)*topic-(.+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/portal.php\?mod=topic&amp;topic={R:2}&amp;{R:3}" />
                </rule>
                <rule name="portal_article">
                        <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/portal.php\?mod=view&amp;aid={R:2}&amp;page={R:3}&amp;{R:4}" />
                </rule>
                <rule name="forum_forumdisplay">
                        <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
                </rule>
                <rule name="forum_viewthread">
                        <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
                        <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:5}" />
                </rule>
                <rule name="group_group">
                        <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/forum.php\?mod=group&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
                </rule>
                <rule name="home_space">
                        <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/home.php\?mod=space&amp;{R:2}={R:3}&amp;{R:4}" />
                </rule>
                <rule name="home_blog">
                        <match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/home.php\?mod=space&amp;uid={R:2}&amp;do=blog&amp;id={R:3}&amp;{R:4}" />
                </rule>
                <rule name="forum_archiver">
                        <match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$" />
                        <action type="Rewrite" url="{R:1}/archiver/index.php\?action={R:2}&amp;value={R:3}&amp;{R:4}" />
                </rule>
        </rules>
</rewrite>


版权声明:
本站资源和文章内容大部分收集于网络,
本站所有资源的版权均属于原作者所有,
本站资源只用于参考学习,请勿直接商用,
若由于商用引起版权纠纷,一切责任均由使用者承担。
若有侵权之处请联系站长我们会第一时间删除

本文由XM技术学习分享发布,如需转载请注明出处。

本文链接:http://xmwl.cc/mb/59.html

分享给朋友: