Discuz! X2的伪静态配置方法_DX2如何静态化.doc_第1页
Discuz! X2的伪静态配置方法_DX2如何静态化.doc_第2页
Discuz! X2的伪静态配置方法_DX2如何静态化.doc_第3页
Discuz! X2的伪静态配置方法_DX2如何静态化.doc_第4页
Discuz! X2的伪静态配置方法_DX2如何静态化.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

对于Discuz! X2的伪静态配置,分两种情况,一种是独立主机用户,一种是虚拟主机用户,独立主机用户拥有对主机的管理权限,因此配置起来比较方便一些。首先确定您使用的 Apache 版本,及是否加载了 mod_Rewrite 模块。 Apache 1.x 的用户请检查 conf/httpd.conf 中是否存在如下两段代码: LoadModule Rewrite_module libexec/mod_Rewrite.soAddModule mod_Rewrite.cApache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码: LoadModule Rewrite_module modules/mod_Rewrite.so如果存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 中去,如果加在虚拟主机配置外部将可能无法使用,改好后将 Apache 重启。一、Apache Web Server(独立主机用户)RewriteEngine OnRewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2&%1RewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/forum-(w+)-(0-9+).html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1RewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/thread-(0-9+)-(0-9+)-(0-9+).html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3&%1RewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/group-(0-9+)-(0-9+).html$ $1/forum.php?mod=group&fid=$2&page=$3&%1RewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/space-(username|uid)-(.+).html$ $1/home.php?mod=space&$2=$3&%1RewriteCond %QUERY_STRING (.*)$RewriteRule (.*)/(fid|tid)-(0-9+).html$ $1/index.php?action=$2&value=$3&%1如果没有安装 mod_Rewrite,您可以重新编译 Apache,并在原有 configure 的内容中加入 -enable-Rewrite=shared,然后再在Apache 配置文件中加入上述代码即可。二、Apache Web Server(虚拟主机用户)在开始以下设置之前,请首先咨询您的空间服务商,空间是否支持 Rewrite 以及是否支持对站点目录中 .htaccess 的文件解析,否则即便按照下面的方法设置好了,也无法使用。 检查论坛所在目录中是否存在 .htaccess 文件,如果不存在,请手工建立此文件。Win32 系统下,无法直接建立 .htaccess 文件,您可以从其他系统中拷贝一份,编辑并修改 .htaccess 文件,添加以下内容:# 将 RewriteEngine 模式打开RewriteEngine On# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /RewriteBase /discuz# Rewrite 系统规则请勿修改RewriteCond %QUERY_STRING (.*)$RewriteRule topic-(.+).html$ portal.php?mod=topic&topic=$1&%1RewriteCond %QUERY_STRING (.*)$RewriteRule forum-(w+)-(0-9+).html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1RewriteCond %QUERY_STRING (.*)$RewriteRule thread-(0-9+)-(0-9+)-(0-9+).html$ forum.php?mod=viewthread&tid=$1&extra=page%3D$3&page=$2&%1RewriteCond %QUERY_STRING (.*)$RewriteRule group-(0-9+)-(0-9+).html$ forum.php?mod=group&fid=$1&page=$2&%1RewriteCond %QUERY_STRING (.*)$RewriteRule space-(username|uid)-(.+).html$ home.php?mod=space&$1=$2&%1RewriteCond %QUERY_STRING (.*)$RewriteRule archiver/(fid|tid)-(0-9+).html$ archiver/index.php?action=$1&value=$2&%1三、IIS Web Server(独立主机用户)说明:IIS 下的 Rewrite 需要添加组件,通过筛选器的方式实现,下面是组件的下载与配置方法:IIS Rewrite 下载: Rewrite.zip【如果下载不了加QQ:】IIS Rewrite 配置1、将下载的 IIS Rewrite 组件解压,放到任意盘上的任意目录(如 C:Rewrite 下)2、在 IIS 管理器里选择网站,右键选择“属性”,如下图所示:在弹出的窗口里选择“ISAPI筛选器”上图中点击“添加”,在弹出的窗口里“筛选器名称”填写“rewrite”上图界面中点击“浏览”,选择下载解压后的 IIS Rewrite 组件目录下的 Rewrite.dll 文件浏览完毕点击“确定”添加完毕点击“确定重新启动 IIS重新选择该站点 = 右键“属性”= “ISAPI 筛选器”,如果看到状态为向上的绿色箭头,就说明 Rewrite 模块安装成功了。这个时候返回到论坛首页随便打开一个版块或者一个帖子即可看到 Discuz! 的 Rewrite伪静态配置成功!四、IIS7 Web Server(独立主机用户)可以将如下的配置规则加入到 web.config 中 五、Nginx Web Server配置规则如下:rewrite (.*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2 last;rewrite (.*)/forum-(w+)-(0-9+).html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;rewrite (.*)/thread-(0-9+)-(0-9+)-(0-9+).html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;rewrite (.*)/group-(0-9+)-(0-9+).html$ $1/forum.php?mod=group&fid=$2&page=$3 last;rewrite (.*)/space-(username|uid)-(.+).html$ $1/home.php?mod=space&$2=$3 last;rewrite (.*)/(fid|tid)-(0-9+).html$ $1/index.php?action=$2&value=$3 last;if (!-e $request_filename) return 404;六、Zeus Web Server配置规则如下:match URL into $ with (.*)/topic-(.+).html?*(.*)$if matched thenset URL = $1/portal.php?mod=topic&topic=$2&$3endifmatch URL into $ with (.*)/forum-(w+)-(0-9+).html?*(.*)$if matched thenset URL = $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4endifmatch URL into $ with (.*)/thread-(0-9+)-(0-9+)-(0-9+).html?*(.*)$if matched thenset URL = $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3&$5endifmatch URL into $ with (.*)/group-(0-9+)-(0-9+).html?*(.*)$if matched thenset URL = $1/forum.php?mod=group&fid=$2&page=$3&$4endifmatch URL into $ with (.*)/space-(username|uid)-(.+).html?*(.*)$if matched thenset U

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论