最新开启URL静态的Rewrite规则 For DZ7.2/UCH2.0/SS7.5

Apache环境下开启 URL 静态化:

独立主机用户需要对 Web 服务器增加相应的 Rewrite 规则,因此需要有服务器权限。

对于虚拟主机用户,您需要向空间服务商进行咨询:空间是否支持 Rewrite 以及是否支持对站点目录中 .htaccess 文件的解析,只有满足这两个条件,URL 静态化功能才会生效。

Apache环境下开启详细配置方法可见:http://faq.comsenz.com/viewnews-12

下面是独立主机和虚拟主机下各产品所需的 Rewrite 规则下载:

独立主机:

Discuz! 7.2 Rewrite规则下载:


RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2

UCenter Home 2.0 Rewrite规则下载:


RewriteEngine On
RewriteRule ^/(space|network)\-(.+)\.html$ /$1.php?Rewrite=$2 [L]
RewriteRule ^/(space|network)\.html$ /$1.php [L]
RewriteRule ^/([0-9]+)$ /space.php?uid=$1 [L]

SupeSite/X-Space 7.5 Rewrite规则下载:


RewriteEngine On
###Rewrite 系统规则请勿修改
RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L]
RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L]
RewriteRule ^/action(.+)$ /index.php?action$1 [L]
RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L]
RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L]
RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L]
RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]

虚拟主机:

Discuz! 7.2 Rewrite规则下载:

# 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /discuz
# Rewrite 系统规则请勿修改
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
RewriteRule ^tag-(.+)\.html$ tag.php?name=$1

UCenter Home 2.0 Rewrite规则下载:

RewriteEngine On
RewriteBase /
RewriteRule ^(space|network)\-(.+)\.html$ $1.php?Rewrite=$2 [L]
RewriteRule ^(space|network)\.html$ $1.php [L]
RewriteRule ^([0-9]+)$ space.php?uid=$1 [L]

SupeSite/X-Space 7.5 Rewrite规则下载:

### 将 RewriteEngine 模式打开
RewriteEngine On

### 修改以下语句中的 /SupeSite 修改为你的SupeSite目录地址,如果程序放在根目录中,请将 /SupeSite 修改为 /
RewriteBase /SupeSite
### Rewrite 系统规则请勿修改
RewriteRule ^([0-9]+)/spacelist(.+)$ index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^([0-9]+)/viewspace(.+)$ index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^([0-9]+)/viewbbs(.+)$ index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^([0-9]+)/(.*)$ index.php?uid/$1/$2 [L]
RewriteRule ^([0-9]+)$ index.php?uid/$1 [L]
RewriteRule ^action(.+)$ index.php?action$1 [L]
RewriteRule ^category(.+)$ index.php?action/category/catid$1 [L]
RewriteRule ^viewnews(.+)$ index.php?action/viewnews/itemid$1 [L]
RewriteRule ^viewthread(.+)$ index.php?action/viewthread/tid$1 [L]
RewriteRule ^mygroup(.+)$ index.php?action/mygroup/gid$1 [L]

本文来源于康胜帮助文档rewrite规则。为方便查阅,特整理于此,最后更新时间为:十二月 11,2009

转载请注明出处:https://www.onexin.net/open_url_rewrite_for_dz7x_uch2x_ss7x/

相关文章:

1、RewriteRule 301设置后搜索引擎保留的哪个网址
https://www.onexin.net/301-redirect/

2、如何做301重定向(扩展篇)
https://www.onexin.net/how-to-do-a-301-redirect/

3、Apache rewrite 详解
https://www.onexin.net/apache-rewrite-detailed/

4、nginx rewrite 参考资料
https://www.onexin.net/nginx-rewrite-references/

5、网站加速终极篇非gzip优化
https://www.onexin.net/accelerate-the-realization-of-the-ultimate-chapter-rewrite-non-gzip-site-optimization/

Leave a Reply