久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區
標題:
discuz X3.4 TAG標簽偽靜態方法
[打印本頁]
作者:
zengrenrui
時間:
2019-7-15 10:54
標題:
discuz X3.4 TAG標簽偽靜態方法
要養成原文件備份的好習慣。
演示地址:
https://bbs.jatxh.cn/tag.html
1. 修改帖子內tag標簽鏈接,使其偽靜態。
打開template/default(模板風格)/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]
復制代碼
替換為
<a title="$var[1]" href="tag-$var[0].html" target="_blank">$var[1]</a>
[color=rgb(51, 51, 51) !important]
復制代碼
2. 修改tag頁,使各個標簽鏈接偽靜態。
打開
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]
復制代碼
替換為
<a href="tag-$tag[tagid].html" title="$tag[tagname]" target="_blank" class="xi2">$tag[tagname]</a>
[color=rgb(51, 51, 51) !important]
復制代碼
3. 修改tag列表頁當前位置,使其路徑鏈接偽靜態。
打開template/default/tag/tagitem.htm,查找
<a href="misc.php?mod=tag">{lang tag}</a>
[color=rgb(51, 51, 51) !important]
復制代碼
替換為
<a href="tag.html">{lang tag}</a>
[color=rgb(51, 51, 51) !important]
復制代碼
再查找
<a href="misc.php?mod=tag&id=$id">$tagname</a>
[color=rgb(51, 51, 51) !important]
復制代碼
替換為
<a href="tag-$id.html">$tagname</a>
[color=rgb(51, 51, 51) !important]
復制代碼
4. 讓搜索引擎蜘蛛可爬。
修改根目錄下robort.txt,刪除
Disallow: /misc.php
Disallow: /*?mod=misc*
[color=rgb(51, 51, 51) !important]
復制代碼
修改根目錄下misc.php文件,注釋或刪除
$discuz->reject_robot();
[color=rgb(51, 51, 51) !important]
復制代碼
5. 添加偽靜態規則。
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
[color=rgb(51, 51, 51) !important]
復制代碼
WIN的添加(httpd.ini)偽靜態規則:(未測,是否可用未知)
RewriteRule ^(.*)/tag-(.+)\.html*$ $1/misc.php\?mod=tag&id=$2
RewriteRule ^(.*)/tag\.html*$ $1/misc.php\?mod=tag
[color=rgb(51, 51, 51) !important]
復制代碼
要保證規則文件內最后一條偽靜態規則為
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1
[color=rgb(51, 51, 51) !important]
復制代碼
或者
RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5
[color=rgb(51, 51, 51) !important]
復制代碼
否則顯示插件不存在或已關閉。
原文地址:
https://bbs.jatxh.cn/thread-73980-1-1.html
作者:
zengrenrui
時間:
2019-7-15 10:55
怎么復制過來亂碼呢!
作者:
q813289
時間:
2019-7-17 08:19
作者:
q813289
時間:
2019-7-17 08:19
www.cpj123.com
作者:
金黑網絡
時間:
2023-1-26 15:44
discuz!X3.4 TAG標簽偽靜態方法教程
https://www.jinhei.com/thread-426-1-1.html
已收藏,感謝分享。
作者:
TaC
時間:
2024-4-3 19:38
不錯,3.5測試成功
歡迎光臨 Discuz! 官方交流社區 (http://www.9999xn.com/)
Powered by Discuz! W1.0