Discuz!X3.1標籤僞靜態修改和僞靜態規則

(一)、僞靜態規則添加
WIN的添加(httpd.ini)代碼:
RewriteRule ^(.)/tag-(.+).html$ $1/misc.php?mod=tag&id=$2
RewriteRule ^(.)/tag.html$ $1/misc.php?mod=tag

linux系統(.htaccess或httpd.conf)添加代碼
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^tag-(.+).html$ misc.php?mod=tag&id=$1
RewriteCond %{QUERY_STRING} ^(.*)
$RewriteRule ^tag\.html$ misc.php?mod=tag

添加方法:
在原僞靜態最後一行之前添加。我的最後一行規則爲
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html$ plugin.php?id=$1:$2&%1

一些朋友可能爲:
RewriteRule ^(.)/([a-z]+[a-z0-9_])-([a-z0-9_-]+).html(?(.))$ $1/plugin.php?id=$2:$3&$5

看系統而定。 如果不添加在上邊的規則之前,會提示“插件不存在或已關閉”!!!

(二)、修改帖子內標籤鏈接(修改系統文件建議備份,養成好習慣)
X3.1後是 template/default(模板目錄)/forum/viewthread_node_body.htm下載到本地打開
查找:
$var[1]

替換爲:
$var[1]

阿里雲代金券1000元免費領取地址:https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=2a7uv47d
新老阿里雲賬戶均可領取!可用於購買阿里雲服務器ECS、雲數據庫RDS、虛擬主機、安騎士、DDoS高防IP等100多雲計算產品。 代金券自領取之日起,有效期是30天,請及時使用,過30天后還可以重新領取。

(三)、修改標籤頁(tag.htm)標籤鏈接
文件在template/default/tag/tag.htm
查找:
$tag[tagname]

替換爲:
$tag[tagname]
複製代碼

(四)、修改標籤列表頁導航鏈接tagitem.htm
文件在template/default/tag/tagitem.htm
查找1:

{lang tag}

替換爲:
{lang tag}

查找2:
$tagname

替換爲:
$tagname

(五)、最後修改robort.txt讓蜘蛛爬行標籤頁。
刪除或註釋掉根目錄下misc.php的這段代碼
$discuz->reject_robot();

robots.txt文件刪除一下兩條禁止蜘蛛抓去的規則:
Disallow: /misc.phpDisallow: /?mod=misc

上傳替換,完成修改!這時候就完成了標籤僞靜態了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章