Discuz!x2.5完整伪静态.htaccess代码,支持论坛、博客、门户伪静态

前段时间因为玩DZ论坛,需要把博客伪静态,就写了这篇介绍Discuz!x2.5 .htaccess伪静态代码的文章,此文章支持博客伪静态,但今天又发现这篇文章里提到的代码不支持门户文章的伪静态,今天更新了一下,完美支持各种伪静态,代码直接复制到你的.htaccess文件里或直接下载我提供下载的文件,上传到博客根目录即可。

代码:

# 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /

# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%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

直接下载.htaccess文件:

.htaccess

思章老师

认准了方向,就要勇敢地走下去,十年磨一剑,我相信,只要坚持,一切都有可能。

相关日志

  1. 没有图片

    2009.07.26

    金山毒霸通行证7月26日

    通行证:KSDA69262213 密码:01…

  2. 2013.09.10

    大前端WordPress D8主题优化之:缩略图裁切

    大前端浩子同学的新WordPress主题D8…

  3. 没有图片

    2009.12.08

    几大免费PHP类CMS性能测评报告(图片)

    近来网站进行全新改版,因为几个管理员对网站的…

  4. 没有图片

    2009.07.26

    10 个提供 Twitter 热门话题服务的网站

    Twitter 上每天都会更新很多的信息,我…

  5. 没有图片

    2009.09.09

    多彩的 Google 广告样式

    我们在 Google Adsense 里添加…

  6. 没有图片

    2009.07.09

    国外优秀开源PHP建站系统对比分析

    开源(Open Source,开放源码)被非…

评论

  1. 平板盒子 2012.10.03 12:32下午

    这个,直接在DX后台的伪静态那里就有代码,复制粘贴过去就行了。