找回密码
 立即注册
查看: 19|回复: 0

Discuz!X3.4/3.5标签伪静态修改和伪静态规则(亲测可用,完整版)

[复制链接]

147

主题

212

回帖

870

积分

管理员

UID
2
阅读权限
200
在线时间
64 小时
注册时间
2012-6-24
最后登录
2024-5-7
发表于 2024-3-9 21:51:14 | 显示全部楼层 |阅读模式
一)、伪静态规则添加
WIN的添加(httpd.ini)代码:

  • RewriteRule ^(.*)/tag-(.+)\.html*$ $1/misc.php\?mod=tag&id=$2
  • RewriteRule ^(.*)/tag\.html*$ $1/misc.php\?mod=tag

[color=rgb(56, 69, 79) !important]复制代码

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(56, 69, 79) !important]复制代码

添加方法:在原伪静态最后一行之前添加。我的最后一行规则为

  • RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$12&%1

[color=rgb(56, 69, 79) !important]复制代码

一些朋友可能为:

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

[color=rgb(56, 69, 79) !important]复制代码

看系统而定。 如果不添加在上边的规则之前,会提示“插件不存在或已关闭”!!!
(二)、修改帖子内标签链接(修改系统文件建议备份,养成好习惯)
X3.5后是 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(56, 69, 79) !important]复制代码

替换为:

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

[color=rgb(56, 69, 79) !important]复制代码

(三)、修改标签页(tag.htm)标签链接
文件在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(56, 69, 79) !important]复制代码

替换为:

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

[color=rgb(56, 69, 79) !important]复制代码

(四)、修改标签列表页导航链接tagitem.htm
文件在template/default/tag/tagitem.htm
查找1:

  • <a href="misc.php?mod=tag">{lang tag}</a>

[color=rgb(56, 69, 79) !important]复制代码

替换为:

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

[color=rgb(56, 69, 79) !important]复制代码

查找2:

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

[color=rgb(56, 69, 79) !important]复制代码

替换为:

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

[color=rgb(56, 69, 79) !important]复制代码

(五)、最后修改robort.txt让蜘蛛爬行标签页
删除或注释掉根目录下misc.php的这段代码

  • $discuz->reject_robot();

[color=rgb(56, 69, 79) !important]复制代码

robots.txt文件删除一下两条禁止蜘蛛抓去的规则:

  • Disallow: /misc.phpDisallow: /*?mod=misc*

[color=rgb(56, 69, 79) !important]复制代码

上传替换,完成修改!这时候就完成了标签伪静态了。希望对大家有帮助,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|蔡仲秋的个人空间 ( 冀ICP备2024049637号-1|冀公网安备13100002000150号 )

GMT+8, 2024-5-7 10:23

shengfang.ren caizhongqiu

2007-2024

快速回复 返回顶部 返回列表