Discuz X3.2 分區 gid 完美偽靜態方法 Apache/Nginx

來源:互聯網
上載者:User

標籤:splay   lan   template   view   code   版本   bsp   www   nbsp   

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]

 

Discuz X3.2 分區 gid 完美偽靜態方法 Apache/Nginx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.