Win 2008 IIS7.0配置REWRITE伪静态环境 web.config实现Discuz! X3.2伪静态
[p=36, 2, left]1、先到IIS官方下载模块下载地址:[url=http://www.iis.net/downloads/microsoft/url-rewrite]http://www.iis.net/downloads/microsoft/url-rewrite[/url]
根据需要,点击下载链接(我的系统是64位的,就下载x64的)[/p][p=36, 2, left][url=http://images.163ns.com/image/201312/20131230114030063006.jpg][img]http://images.163ns.com/image/201312/20131230114030063006.jpg[/img][/url][/p][p=36, 2, left]2、安装重写模块
我下载的是本地msi包(rewrite_2.0_rtw_x64.msi),双击安装即可[/p][p=36, 2, left]3、打开 “Internet 信息服务(IIS)管理器”,就可以看见模块中多了一个 Url Rewrite 模块[/p][p=36, 2, left][url=http://images.163ns.com/image/201312/20131230114391929192.jpg][img]http://images.163ns.com/image/201312/20131230114391929192.jpg[/img][/url][/p][p=36, 2, left][size=12px]4、把discuz3.1的伪静态规则复制到web.config配置文件里面[/size][/p][p=36, 2, left][size=12px]disucuz伪静态规则可以在网站后台查到,复制IIS7 Web Server(独立主机用户)规则添加到web.config,保存配置文件即可实现disucz伪静态[/size][url=http://images.163ns.com/image/201312/20131230114968286828.jpg][img]http://images.163ns.com/image/201312/20131230114968286828.jpg[/img][/url][/p][p=36, 2, left][font=微软雅黑, Verdana, Helvetica, Arial, sans-serif]提供一个范例给大家:[/font][/p][p=30, 2, left]<?xml version="1.0" encoding="UTF-8"?>[/p][p=30, 2, left]<configuration>[/p][p=30, 2, left] <system.webServer>[/p][p=30, 2, left] <defaultDocument>[/p][p=30, 2, left] <files>[/p][p=30, 2, left] <add value="forum.php" />[/p][p=30, 2, left] <add value="index.php" />[/p][p=30, 2, left] </files>[/p][p=30, 2, left] </defaultDocument>[/p][p=30, 2, left][color=#ff0000] <rewrite>[/color][/p][p=30, 2, left][color=#ff0000]
<rules>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="portal_topic">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*topic-(.+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/portal.php\?mod=topic&topic={R:2}&{R:3}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="portal_article">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/portal.php\?mod=view&aid={R:2}&page={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="forum_forumdisplay">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="forum_viewthread">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/forum.php\?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="group_group">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/forum.php\?mod=group&fid={R:2}&page={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="home_space">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/home.php\?mod=space&{R:2}={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="home_blog">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/home.php\?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="forum_archiver">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/index.php\?action={R:2}&value={R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
<rule name="plugin">[/color][/p][p=30, 2, left][color=#ff0000]
<match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$" />[/color][/p][p=30, 2, left][color=#ff0000]
<action type="Rewrite" url="{R:1}/plugin.php\?id={R:2}:{R:3}&{R:4}" />[/color][/p][p=30, 2, left][color=#ff0000]
</rule>[/color][/p][p=30, 2, left][color=#ff0000]
</rules>[/color][/p][p=30, 2, left][color=#ff0000] </rewrite>[/color][/p][p=30, 2, left] </system.webServer>[/p][p=30, 2, left]</configuration>[/p]
[p=36, 2, left][size=12px]也可导入伪静态规则:[/size][/p][p=36, 2, left][img=300,195]http://img0.ph.126.net/RYG_ZbsXiyNpQnk7jzWhkw==/1374723786355088862.jpg[/img]
[font=微软雅黑, Verdana, Helvetica, Arial, sans-serif]导入相应的伪静态的规则就行了[/font]
[img=300,228]http://img2.ph.126.net/BbdLKtIAggqxdfMwstx-QA==/6597518367401414717.jpg[/img]
[img=300,221]http://img2.ph.126.net/CYN-SxUTCdhFhjgNPKBqhQ==/718605615642559505.jpg[/img]
[img=300,194]http://img2.ph.126.net/tAkNpgBwtOI0mKQPLXTHng==/739997713872756800.jpg[/img]
[font=微软雅黑, Verdana, Helvetica, Arial, sans-serif]如果还不行的就,就要修改站点根目录的Web.Config这个文件了。[/font]
[/p] 用于 IIS 7 (x64) 的 Microsoft URL 重写模块 2.0:
[url]https://www.microsoft.com/zh-CN/download/details.aspx?id=7435[/url]
页:
[1]