discuz X 伪静态规则-IIS -Nginx-Apache

2010/05/07  |  7:16 上午分类:discuz, nginx  |  标签:  |  7,902 views

康胜刚刚发布了discuz x beta 版本,在管理后台,全局 » 优化设置 » 搜索引擎优化 选中url静态化的选项即可,相关规则文件官方已经出示例,摘录如下:

IIS-Isapi

[ISAPI_Rewrite]
 
[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&$3
RewriteRule ^(.*)/article-([0-9]+)\.html\?*(.*)$ $1/portal\.php\?mod=article&articleid=$2&$3
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=group&fid=$2&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/home\.php\?mod=space&$2=$3&$4
RewriteRule ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$ $1/$2\.php\?rewrite=$3&$4


Apache

# 将 RewriteEngine 模式打开
RewriteEngine On
 
# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /discuz
 
# Rewrite 系统规则请勿修改
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1
RewriteRule ^article-([0-9]+)\.html$ portal.php?mod=article&articleid=$1
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2
RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2

Nginx Web Server

rewrite ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^(.*)/article-([0-9]+)\.html$ $1/portal.php?mod=article&articleid=$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 ^(.*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;

IIS用户可直接下载些httpd.ini文件放至网站根目录下  Download discuzx Version beta

喜欢本文,那就收藏到: Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

9条评论 关于 “discuz X 伪静态规则-IIS -Nginx-Apache”

  1. 齐鲁电影网 发表于: 五月 11th, 2010 12:48 下午

    好快啊,每次有需要都来博主这里转转,每次都有斩获啊。

    [回复]

  2. 柳絮轻飞博客 发表于: 五月 11th, 2010 12:49 下午

    不错,正好需要,柳絮轻飞博客支持你!

    [回复]

  3. 知道 发表于: 五月 20th, 2010 9:58 上午

    觉得你的站不错!!!

    [回复]

  4. 易唐归来 发表于: 五月 24th, 2010 9:28 上午

    apache 伪静态是否支持中文输出?比如公司简介.html等

    [回复]

    衣不如新 回复:

    支持的

    [回复]

  5. 易棋牌 发表于: 六月 12th, 2010 3:18 上午

    不错哦““““有空来我这看看

    [回复]

  6. 枫子 发表于: 九月 7th, 2010 2:47 下午

    最近特喜欢看你这方面的博客..很好看。

    [回复]

  7. 网赚博客 发表于: 十月 8th, 2010 2:16 上午

    博主的博客不错啊。网赚博客(www.beiren.info)想和博主做个友情链接,可以的话,加806768613

    [回复]

  8. 稻草人 发表于: 十月 26th, 2010 3:19 下午

    你好,我用的是discuz X1.5的程序,空间是Linux主机 请问 静态规则文件怎么写啊?谢谢回答!

    [回复]


发表您的评论