如何为 Discuz X3 配置伪静态Word下载.docx
《如何为 Discuz X3 配置伪静态Word下载.docx》由会员分享,可在线阅读,更多相关《如何为 Discuz X3 配置伪静态Word下载.docx(15页珍藏版)》请在冰豆网上搜索。
5RewriteCond%{QUERY_STRING}^(.*)$
6RewriteRule^(.*)/forum-(\w+)-([0-9]+)\.html$$1/forum.php?
mod=forumdisplay&
fid=$2&
page=$3&
7RewriteCond%{QUERY_STRING}^(.*)$
8RewriteRule^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$$1/forum.php?
mod=viewthread&
tid=$2&
extra=page\%
93D$4&
10RewriteCond%{QUERY_STRING}^(.*)$
11RewriteRule^(.*)/group-([0-9]+)-([0-9]+)\.html$$1/forum.php?
mod=group&
12RewriteCond%{QUERY_STRING}^(.*)$
13RewriteRule^(.*)/space-(username|uid)-(.+)\.html$$1/home.php?
mod=space&
$2=$3&
14RewriteCond%{QUERY_STRING}^(.*)$
15RewriteRule^(.*)/(fid|tid)-([0-9]+)\.html$$1/index.php?
action=$2&
value=$3&
16<
/IfModule>
复制代码
17
如果没有安装mod_Rewrite,您可以重新编译Apache,并在原有configure的内容中加入--enable-Rewrite=shared,然后再在Apache配置文件中加入上述代码即可。
二、ApacheWebServer(虚拟主机用户)
在开始以下设置之前,请首先咨询您的空间服务商,空间是否支持Rewrite以及是否支持对站点目录中.htaccess的文件解析,否则即便按照下面的方法设置好了,也无法使用。
检查论坛所在目录中是否存在.htaccess文件,如果不存在,请手工建立此文件。
Win32系统下,无法直接建立.htaccess文件,您可以从其他系统中拷贝一份,编辑并修改.htaccess文件,添加以下内容:
#将RewriteEngine模式打开
18RewriteEngineOn
19#修改以下语句中的/discuz为你的论坛目录地址,如果程序放在根目录中,请将/discuz修改为/
20RewriteBase/discuz
21#Rewrite系统规则请勿修改
22RewriteCond%{QUERY_STRING}^(.*)$
23RewriteRule^topic-(.+)\.html$portal.php?
topic=$1&
24RewriteCond%{QUERY_STRING}^(.*)$
25RewriteRule^forum-(\w+)-([0-9]+)\.html$forum.php?
fid=$1&
page=$2&
26RewriteCond%{QUERY_STRING}^(.*)$
27RewriteRule^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$forum.php?
tid=$1&
extra=page\%3D$3&
28RewriteCond%{QUERY_STRING}^(.*)$
29RewriteRule^group-([0-9]+)-([0-9]+)\.html$forum.php?
30RewriteCond%{QUERY_STRING}^(.*)$
31RewriteRule^space-(username|uid)-(.+)\.html$home.php?
$1=$2&
32RewriteCond%{QUERY_STRING}^(.*)$
33RewriteRule^archiver/(fid|tid)-([0-9]+)\.html$archiver/index.php?
action=$1&
value=$2&
三、IISWebServer(独立主机用户)
说明:
IIS下的Rewrite需要添加组件,通过筛选器的方式实现,下面是组件的下载与配置方法:
IISRewrite下载
Rewrite.zip(100.13KB,下载次数:
36481)
IISRewrite配置
1、将下载的IISRewrite组件解压,放到任意盘上的任意目录(如C:
Rewrite下)
2、在IIS管理器里选择网站,右键选择“属性”,如下图所示:
在弹出的窗口里选择“ISAPI筛选器”
上图中点击“添加”,在弹出的窗口里“筛选器名称”填写“rewrite”
上图界面中点击“浏览”,选择下载解压后的IISRewrite组件目录下的Rewrite.dll文件
浏览完毕点击“确定”
添加完毕点击“确定
重新启动IIS
重新选择该站点=>
右键“属性”=>
“ISAPI筛选器”,如果看到状态为向上的绿色箭头,就说明Rewrite模块安装成功了。
这个时候返回到论坛首页随便打开一个版块或者一个帖子即可看到Discuz!
的Rewrite伪静态配置成功!
34
四、IIS7WebServer(独立主机用户)
可以将如下的配置规则加入到web.config中
35<
rewrite>
36<
rules>
37<
rulename="
portal_topic"
>
38<
matchurl="
^(.*/)*topic-(.+).html\?
*(.*)$"
/>
39<
actiontype="
Rewrite"
url="
{R:
1}/portal.php\?
amp;
topic={R:
2}&
3}"
40<
/rule>
41<
forum_forumdisplay"
42<
^(.*/)*forum-(\w+)-([0-9]+).html\?
43<
1}/forum.php\?
fid={R:
page={R:
3}&
4}"
44<
45<
forum_viewthread"
46<
^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?
47<
tid={R:
extra=page%3D{R:
4}&
5}"
48<
49<
group_group"
50<
^(.*/)*group-([0-9]+)-([0-9]+).html\?
51<
52<
53<
home_space"
54<
^(.*/)*space-(username|uid)-(.+).html\?
55<
1}/home.php\?
2}={R:
56<
57<
forum_archiver"
58<
^(.*/)*(fid|tid)-([0-9]+).html\?
59<
1}/index.php\?
action={R:
value={R:
60<
61<
/rules>
62<
/rewrite>
63
五、ZeusWebServer
配置规则如下:
64matchURLinto$with^(.*)/topic-(.+)\.html\?
*(.*)$
65ifmatchedthen
66setURL=$1/portal.php?
$3
67endif
68matchURLinto$with^(.*)/forum-(\w+)-([0-9]+)\.html\?
69ifmatchedthen
70setURL=$1/forum.php?
$4
71endif
72matchURLinto$with^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?
73ifmatchedthen
74setURL=$1/forum.php?
extra=page\%3D$4&
$5
75endif
76matchURLinto$with^(.*)/group-([0-9]+)-([0-9]+)\.html\?
77ifmatchedthen
78setURL=$1/forum.php?
79endif
80matchURLinto$with^(.*)/space-(username|uid)-(.+)\.html\?
81ifmatchedthen
82setURL=$1/home.php?
83endif
84matchURLinto$with^(.*)/(fid|tid)-([0-9]+)\.html\?
85ifmatchedthen
86setURL=$1/index.php?
87endif
88
六、NginxWebServer
89rewrite^([^\.]*)/topic-(.+)\.html$$1/portal.php?
topic=$2last;
90rewrite^([^\.]*)/forum-(\w+)-([0-9]+)\.html$$1/forum.php?
page=$3last;
91rewrite^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$$1/forum.php?
extra=page%
923D$4&
93rewrite^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$$1/forum.php?
94rewrite^([^\.]*)/space-(username|uid)-(.+)\.html$$1/home.php?
$2=$3last;
95rewrite^([^\.]*)/(fid|tid)-([0-9]+)\.html$$1/index.php?
value=$3last;
96if(!
-e$request_filename){
97return404;
98}