zoukankan      html  css  js  c++  java
  • Discuz X3.2 分区 gid 完美伪静态方法 Apache/Nginx

    Discuz 官方给出的伪静态规则并不完整,只实现了部分的伪静态设置及规则,分区 gid 仍然是 forum.php?gid=xxx 的形式,对于有强迫症的我是无法忍受的,下面给出分区 gid 的伪静态实现方法,包括论坛首页和版块页,列表页,帖子阅读页和论坛发帖页(完美适用于 Discuz X2.5 以上版本,以默认风格为例)。

    演示网址:http://www.bbseat.com.cn/forum.php

    论坛首页:打开 template/default/forum/discuz.htm

    搜索:

    forum.php?gid=$cat[fid]

    替换为:

    forum-$cat[fid].html

    版块页:打开 source/module/forum/forum_forumdisplay.php

    搜索:

    Location: forum.php?gid=$_G[fid]

    替换为:

    Location: forum-$_G[fid].html

    搜索:

    forum.php?gid='.$forum_up['fid'].'

    替换为:

    forum-'.$forum_up['fid'].'.html

    搜索:

    forum.php?gid='.$forum_top['fid'].'

    替换为:

    forum-'.$forum_top['fid'].'.html

    帖子页:打开 source/module/forum/forum_viewthread.php

    搜索:

    ? 'forum.php?gid='.$fup :

    替换为:

    ? 'forum-'.$fup.'.html' :

    这里有两个地方需要修改。

    发帖页:打开 source/module/forum/forum_post.php

    搜索:

    ? 'forum.php?gid='.$fup :

    替换为:

    ? 'forum-'.$fup.'.html' :

    这里也有两个地方需要修改。

    分区伪静态规则

    Nginx伪静态规则:

    rewrite ^([^.]*)/forum-([0-9]+).html$ $1/forum.php?gid=$2 last;

    Apache伪静态规则:

    RewriteCond %{QUERY_STRING} ^(.*)$
    RewriteRule ^forum-(w+).html$ forum.php?gid=$1 [L]
  • 相关阅读:
    CF566E Restoring Map
    CF1034D Intervals of Intervals
    CF1285F Classical?
    Java日报
    课程考核感想
    每日日报8月31日
    每日日报8月30日
    每日日报8月29日
    每日日报8月28日
    每日日报8月27日
  • 原文地址:https://www.cnblogs.com/kimshen/p/6121400.html
Copyright © 2011-2022 走看看