allthebest 發表於 2020-9-24 04:39:05

discuz! x 3.0 - 3.4:TAG标签伪静态设置教程 !

<strong>1. 修改帖子内tag标签链接,使其伪静态。</strong><br /><br />打开template/default(模板风格)/forum/viewthread_node_body.htm,查找:<br /><br /><ol><li>&lt;a title=&quot;$var&quot; href=&quot;misc.php?mod=tag&amp;id=$var&quot; target=&quot;_blank&quot;&gt;$var&lt;/a&gt;</ol><br /><br />替换为<br /><br /><ol><li>&lt;a title=&quot;$var&quot; href=&quot;tag-$var.html&quot; target=&quot;_blank&quot;&gt;$var&lt;/a&gt;</ol><br /><br /><br /><strong>2. 修改tag页,使各个标签链接伪静态。</strong><br /><br />打开template/default/tag/tag.htm,查找<br /><br /><ol><li>&lt;a href=&quot;misc.php?mod=tag&amp;id=$tag&quot; title=&quot;$tag&quot; target=&quot;_blank&quot; class=&quot;xi2&quot;&gt;$tag&lt;/a&gt;</ol><br /><br />替换为<br /><br /><ol><li>&lt;a href=&quot;tag-$tag.html&quot; title=&quot;$tag&quot; target=&quot;_blank&quot; class=&quot;xi2&quot;&gt;$tag&lt;/a&gt;</ol><br /><br /><br /><strong>3. 修改tag列表页当前位置,使其路径链接伪静态。</strong><br /><br />打开template/default/tag/tagitem.htm,查找<br /><br /><ol><li>&lt;a href=&quot;misc.php?mod=tag&quot;&gt;{lang tag}&lt;/a&gt;</ol><br /><br />替换为<br /><br /><ol><li>&lt;a href=&quot;tag.html&quot;&gt;{lang tag}&lt;/a&gt;</ol><br /><br />再查找<br /><br /><ol><li>&lt;a href=&quot;misc.php?mod=tag&amp;id=$id&quot;&gt;$tagname&lt;/a&gt;</ol><br /><br />替换为<br /><br /><ol><li>&lt;a href=&quot;tag-$id.html&quot;&gt;$tagname&lt;/a&gt;</ol><br /><br /><br /><strong>4. 让搜索引擎蜘蛛可爬。</strong><br /><br />修改根目录下robort.txt,删除<br /><br />Disallow: /misc.php<br />Disallow: /*?mod=misc*<br /><br />修改根目录下misc.php文件,删除<br /><br />$discuz-&gt;reject_robot();<br /><br /><br /><strong>5. 添加伪静态规则。</strong><br /><br />linux系统(.htaccess或httpd.conf)伪静态规则:<br /><br />RewriteCond %{QUERY_STRING} ^(.*)$<br />RewriteRule ^tag-(.+)\.html$ misc.php?mod=tag&amp;id=$1<br />RewriteCond %{QUERY_STRING} ^(.*)<br />RewriteRule ^tag\.html$ misc.php?mod=tag<br /><br />WIN的添加(httpd.ini)伪静态规则:<br /><br />RewriteRule ^(.*)/tag-(.+)\.html*$ $1/misc.php\?mod=tag&amp;id=$2<br />RewriteRule ^(.*)/tag\.html*$ $1/misc.php\?mod=tag<br /><br />要保证规则文件内最后一条伪静态规则为<br /><br />RewriteRule ^(+*)-(+)\.html$ plugin.php?id=$1:$2&amp;%1<br /><br />或者<br /><br />RewriteRule ^(.*)/(+*)-(+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&amp;$5<br /><br />**否则显示插件不存在或已关闭。<br /><br /><br /><br /><br /><br /><br />tag<em>, </em>php<em>, </em>misc<em>, </em>静态<em>, </em>RewriteRule

hydeist 發表於 2022-12-7 20:27:04

你好,请问宝塔面板是应该把你这段添加到哪个目录下的文件上的?

reinjia 發表於 2023-12-27 18:53:07

<br />可以在宝塔文件里面找到对应的文件编辑。
頁: [1]
查看完整版本: discuz! x 3.0 - 3.4:TAG标签伪静态设置教程 !