Discuz!X3.1IIS/Apache/Linux、虚拟主机、VPS、独立主机、服务器伪静态规则的配置工具/原料Discuz!X3.1虚拟主机或者vps主机方法/步骤1Discuz!X3.1VPS主机的伪静态httpd.conf规则设置:(1)服务器系统及PHP:WINNT/PHPv5.X.X服务器软件:Micro
Discuz! X3.1
IIS/Apache/Linux、虚拟主机、VPS、独立主机、服务器伪静态规则的配置
工具/原料
Discuz! X3.1
虚拟主机或者vps主机
方法/步骤 1
Discuz!
X3.1VPS主机的伪静态httpd.conf规则设置:
(1)服务器系统及 PHP:WINNT / PHP
v5.X.X服务器软件:Microsoft-IIS/6.0
httpd.conf规则设置:
RegistratiOnName= wlqcwin
RegistratiOnCode= 2EAD-35GH-66NN-ZYBA
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 自定义错误页面
ErrorDocument 404 /404/index.html
# 默认包含了301设置,此设置情况下sxbbs.org/aa.htm
会301跳至www.sxbbs.org/aa.htm,将sxbbs.org替换为您自己的域名就能实现自己的域名的301
# 第一条表示要做跳转的域名,第二条表示要跳转到的域名
RewriteCond %{HTTP:Host} ^sxbbs.org$
RewriteRule (.*) http://www.sxbbs.org$1
[NC,R=301]
# 多个域名做跳转的方法:
# 首先复制多个 RewriteCond 项,将域名改好 除了最后一项,其余的
RewriteCond 项最后都要加个参数 [OR]即可。
RewriteCond %{HTTP:Host} ^0722pp.com$[OR]
RewriteCond %{HTTP:Host}
^www.0722pp.com$[OR]
RewriteCond %{HTTP:Host} ^suiw.net$[OR]
RewriteCond %{HTTP:Host}
^www.suiw.net$[OR]
RewriteCond %{HTTP:Host} ^szggmm.com$[OR]
RewriteCond %{HTTP:Host}
^www.szggmm.com$[OR]
RewriteCond %{HTTP:Host}
^shuizhidu.cn$[OR]
RewriteCond %{HTTP:Host}
^www.shuizhidu.cn$[OR]
RewriteCond %{HTTP:Host} ^hao0722.cn$[OR]
RewriteCond %{HTTP:Host}
^www.hao0722.cn$[OR]
RewriteCond %{HTTP:Host} ^hbsztv.cn$[OR]
RewriteCond %{HTTP:Host} ^www.hbsztv.cn$
RewriteRule (.*) http://www.sxbbs.org$1
[NC,R=301]
# Protect httpd.ini and httpd.parse.errors
files
# from accessing through HTTP
# Discuzx3.1
# 主题分类与分类信息伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/type-(w+)-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=forumdisplay&fid=$2&typeid=$3&typeid=$3&filter=typeid&page=$4
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/sort-(w+)-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=forumdisplay&fid=$2&sortid=$3&sortid=$3&filter=sortid&page=$4
#门户专题页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/topic-(.+).html(?(.*))*$
$1/portal.php?mod=topic&topic=$2&$4
#门户文章页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/article-([0-9]+)-([0-9]+).html(?(.*))*$
$1/portal.php?mod=view&aid=$2&page=$3&$5
#论坛主题列表页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/forum-(w+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=forumdisplay&fid=$2&page=$3&$5
#论坛主题内容页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
#群组主题列表页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/group-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=group&fid=$2&page=$3&$5
#用户个人主页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/space-(username|uid)-(.+).html(?(.*))*$
$1/home.php?mod=space&$2=$3&$5
#用户日志内容页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/blog-([0-9]+)-([0-9]+).html(?(.*))*$
$1/home.php?mod=space&uid=$2&do=blog&id=$3&$5
#论坛 Archiver 页伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/(fid|tid)-([0-9]+).html(?(.*))*$
$1/index.php?action=$2&value=$3&$5
#插件伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html(?(.*))*$
$1/plugin.php?id=$2:$3&$5
2
httpd.ini:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors
files
# from accessing through HTTP
RewriteRule ^(.*)/topic-(.+).html(?(.*))*$
$1/portal.php?mod=topic&topic=$2&$4
RewriteRule
^(.*)/article-([0-9]+)-([0-9]+).html(?(.*))*$
$1/portal.php?mod=view&aid=$2&page=$3&$5
RewriteRule
^(.*)/forum-(w+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=forumdisplay&fid=$2&page=$3&$5
RewriteRule
^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
RewriteRule
^(.*)/group-([0-9]+)-([0-9]+).html(?(.*))*$
$1/forum.php?mod=group&fid=$2&page=$3&$5
RewriteRule
^(.*)/space-(username|uid)-(.+).html(?(.*))*$
$1/home.php?mod=space&$2=$3&$5
RewriteRule
^(.*)/blog-([0-9]+)-([0-9]+).html(?(.*))*$
$1/home.php?mod=space&uid=$2&do=blog&id=$3&$5
RewriteRule
^(.*)/(fid|tid)-([0-9]+).html(?(.*))*$
$1/index.php?action=$2&value=$3&$5
RewriteRule
^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html(?(.*))*$
$1/plugin.php?id=$2:$3&$5
3
(2)服务器系统及 PHP : Linux / PHP
v5.X.X服务器软件:Apache.htaccess的规则配置:
# 将 RewriteEngine 模式打开
RewriteEngine On
ErrorDocument 404 /404/index.html
RewriteCond %{HTTP_HOST} ^sxbbs.org$ [NC]
RewriteRule ^(.*)$ http://www.sxbbs.org/$1
[R=301,L]
# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将
/discuz 修改为 /
RewriteBase /
# Rewrite 系统规则请勿修改
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+).html$
portal.php?mod=topic&topic=$1&%1
#Discuz!门户专题伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/topic-(.+).html$
$1/portal.php?mod=topic&topicid=$2&%1
#论坛其他伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+).html$
portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(w+)-([0-9]+).html$
forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^thread-([0-9]+)-([0-9]+)-([0-9]+).html$
forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+).html$
forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+).html$
home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-([0-9]+)-([0-9]+).html$
home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^archiver/(fid|tid)-([0-9]+).html$
archiver/index.php?action=$1&value=$2&%1
#主题分类与分类信息伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^type-(w+)-([0-9]+)-([0-9]+).html$
forum.php?mod=forumdisplay&fid=$1&typeid=$2&typeid=$2&filter=typeid&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^sort-(w+)-([0-9]+)-([0-9]+).html$
forum.php?mod=forumdisplay&fid=$1&sortid=$2&sortid=$2&filter=sortid&page=$3&%1
#插件伪静态
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule
^([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html$
plugin.php?id=$1:$2&%1
END