1、先到IIS官方下载模块
下载地址:http://www.iis.net/downloads/microsoft/url-rewrite
根据需要,点击下载链接(我的系统是64位的,就下载x64的)
2、安装重写模块
我下载的是本地msi包(rewrite_2.0_rtw_x64.msi),双击安装即可
3、打开 “Internet 信息服务(IIS)管理器”,就可以看见模块中多了一个 Url Rewrite 模块
4、把discuz3.1的伪静态规则复制到web.config配置文件里面
disucuz伪静态规则可以在网站后台查到,复制IIS7 Web Server(独立主机用户)规则添加到web.config,保存配置文件即可实现disucz伪静态
提供一个范例给大家:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="forum.php" />
<add value="index.php" />
</files>
</defaultDocument>
<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>
也可导入伪静态规则:
导入相应的伪静态的规则就行了
如果还不行的就,就要修改站点根目录的Web.Config这个文件了。
欢迎光临 逐梦论坛 (http://temp2023.zhumeng.org/) | Powered by Discuz! 7.2 |