久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發(fā)帖
查看: 5896|回復(fù): 5

discuz X3.4 TAG標(biāo)簽偽靜態(tài)方法

20

主題

58

回帖

110

積分

漸入佳境

貢獻(xiàn)
0 點(diǎn)
金幣
28 個(gè)
樓主
發(fā)表于 2019-7-15 10:54:45 | 只看樓主 |倒序?yàn)g覽 |閱讀模式
要養(yǎng)成原文件備份的好習(xí)慣。演示地址:https://bbs.jatxh.cn/tag.html

1. 修改帖子內(nèi)tag標(biāo)簽鏈接,使其偽靜態(tài)。
打開(kāi)template/default(模板風(fēng)格)/forum/viewthread_node_body.htm,查找:
  • <a title="$var[1]" href="misc.php?mod=tag&id=$var[0]" target="_blank">$var[1]</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


替換為
  • <a title="$var[1]" href="tag-$var[0].html" target="_blank">$var[1]</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


2. 修改tag頁(yè),使各個(gè)標(biāo)簽鏈接偽靜態(tài)。
打開(kāi)template/default/tag/tag.htm,查找
  • <a href="misc.php?mod=tag&id=$tag[tagid]" title="$tag[tagname]" target="_blank" class="xi2">$tag[tagname]</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


替換為
  • <a href="tag-$tag[tagid].html" title="$tag[tagname]" target="_blank" class="xi2">$tag[tagname]</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


3. 修改tag列表頁(yè)當(dāng)前位置,使其路徑鏈接偽靜態(tài)。
打開(kāi)template/default/tag/tagitem.htm,查找
  • <a href="misc.php?mod=tag">{lang tag}</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼



替換為
  • <a href="tag.html">{lang tag}</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


再查找
  • <a href="misc.php?mod=tag&id=$id">$tagname</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


替換為
  • <a href="tag-$id.html">$tagname</a>

[color=rgb(51, 51, 51) !important]復(fù)制代碼


4. 讓搜索引擎蜘蛛可爬。
修改根目錄下robort.txt,刪除
  • Disallow: /misc.php
  • Disallow: /*?mod=misc*

[color=rgb(51, 51, 51) !important]復(fù)制代碼


修改根目錄下misc.php文件,注釋或刪除
  • $discuz->reject_robot();

[color=rgb(51, 51, 51) !important]復(fù)制代碼


5. 添加偽靜態(tài)規(guī)則。
linux系統(tǒng)(.htaccess或httpd.conf)偽靜態(tài)規(guī)則:
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^tag-(.+)\.html$ misc.php?mod=tag&id=$1
  • RewriteCond %{QUERY_STRING} ^(.*)
  • RewriteRule ^tag\.html$ misc.php?mod=tag

[color=rgb(51, 51, 51) !important]復(fù)制代碼


WIN的添加(httpd.ini)偽靜態(tài)規(guī)則:(未測(cè),是否可用未知)
  • RewriteRule ^(.*)/tag-(.+)\.html*$ $1/misc.php\?mod=tag&id=$2
  • RewriteRule ^(.*)/tag\.html*$ $1/misc.php\?mod=tag

[color=rgb(51, 51, 51) !important]復(fù)制代碼


要保證規(guī)則文件內(nèi)最后一條偽靜態(tài)規(guī)則為
  • RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1

[color=rgb(51, 51, 51) !important]復(fù)制代碼


或者
  • RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5

[color=rgb(51, 51, 51) !important]復(fù)制代碼


否則顯示插件不存在或已關(guān)閉。



原文地址:https://bbs.jatxh.cn/thread-73980-1-1.html
回復(fù)

使用道具 舉報(bào)

20

主題

58

回帖

110

積分

漸入佳境

貢獻(xiàn)
0 點(diǎn)
金幣
28 個(gè)
沙發(fā)
 樓主| 發(fā)表于 2019-7-15 10:55:14 | 只看Ta
怎么復(fù)制過(guò)來(lái)亂碼呢!
回復(fù)

使用道具 舉報(bào)

1

主題

4

回帖

7

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
2 個(gè)
QQ
板凳
發(fā)表于 2019-7-17 08:19:08 | 只看Ta
回復(fù)

使用道具 舉報(bào)

1

主題

4

回帖

7

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
2 個(gè)
QQ
地板
發(fā)表于 2019-7-17 08:19:34 | 只看Ta
www.cpj123.com
回復(fù)

使用道具 舉報(bào)

19

主題

165

回帖

203

積分

爐火純青

貢獻(xiàn)
0 點(diǎn)
金幣
10 個(gè)
QQ
5#
發(fā)表于 2023-1-26 15:44:43 | 只看Ta
discuz!X3.4 TAG標(biāo)簽偽靜態(tài)方法教程
https://www.jinhei.com/thread-426-1-1.html
已收藏,感謝分享。
回復(fù)

使用道具 舉報(bào)

TaC

104

主題

616

回帖

766

積分

自成一派

貢獻(xiàn)
5 點(diǎn)
金幣
3 個(gè)
6#
發(fā)表于 2024-4-3 19:38:44 | 只看Ta
不錯(cuò),3.5測(cè)試成功
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

  • 關(guān)注公眾號(hào)
  • 有償服務(wù)微信
  • 有償服務(wù)QQ

手機(jī)版|小黑屋|Discuz! 官方交流社區(qū) ( 皖I(lǐng)CP備16010102號(hào) |皖公網(wǎng)安備34010302002376號(hào) )|網(wǎng)站地圖|star

GMT+8, 2025-7-1 21:53 , Processed in 0.051981 second(s), 12 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2025 Discuz! Team.

關(guān)燈 在本版發(fā)帖
有償服務(wù)QQ
有償服務(wù)微信
返回頂部
快速回復(fù) 返回頂部 返回列表