快乐兰子 發表於 2025-6-16 00:00:00

Discuz! x2去除forum.php尾巴的方法小结

<p>首先声明:这是一篇去除discuz论坛中forum.php尾巴最全的方法,之前也看到过类似的文章,但按照步骤操作后,大家会发现还有很多地方没有去掉forum.php尾巴。这样不利于网站seo。今天,为大家整理了最完美的去除forum.php尾巴的方法。</p>
<p>在操作之前,我们先来看一下discuz论坛含有forum.php尾巴的地方:</p>
<p>(1)主导航中的论坛按钮</p>
<p><img style="max-width:100%!important;height:auto!important;"alt="主导航论坛按钮" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616093535618.jpg" /></p>
<p>(2)论坛首页的面包屑导航位置</p>
<p>(3)分区版块的面包屑导航位置</p>
<p>(4)主题列表页的面包屑导航位置</p>
<p>(5)主题内容页的面包屑导航位置</p>
<p><img style="max-width:100%!important;height:auto!important;"alt="面包屑导航" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-25061609353A95.jpg" /></p>
<p>(6)发新主题页面包屑导航位置</p>
<p>(7)主题列表页的2个返回按钮</p>
<p><img style="max-width:100%!important;height:auto!important;"alt="主题内容页两个返回按钮" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616093536219.jpg" /></p>
<p>(8)archiver/的首页</p>
<p><img style="max-width:100%!important;height:auto!important;"alt="acchiver首页" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616093536122.jpg" /></p>
<p>(9)输入域名默认跳转到带有www.域名.com/forum.php</p>
<p>既然知道了,discuz论坛都是那些地方含有forum.php,接下来就按照以下步骤来逐一去除</p>
<p><strong>(1)在后台设置域名</strong></p>
<p><img style="max-width:100%!important;height:auto!important;"alt="域名设置" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-25061609353A02.jpg" /></p>
<p>这步设置之后,主导航中的论坛按钮就去掉了forum.php尾巴</p>
<p><strong>(2)在template\default\forum中找到discuz.htm,大约在第19行的位置,</strong></p>
<p>把修改为:</p>
<p>这样,首页和分区版块的面包屑导航中的forum.php就去掉了。</p>
<p><strong>(3)在/source/module/forum/中</strong></p>
<p>forum_forumdisplay.php,第65、67、74、76行:把修改为: (去除主题列表页面包屑导航位置的forum.php尾巴)</p>
<p>forum_viewthread.php,第107行:把修改为: (去除主题内容页面包屑导航位置的forum.php尾巴)</p>
<p>forum_post.php,第111行:把修改为:(去除主题发心主题面包屑导航位置的forum.php尾巴)</p>
<p>forum_misc.php,第394、398行:把修改为: (这个应该是手机版的)</p>
<p><strong>(4)/template/default/forum/ 中</strong></p>
<p>forumdisplay.htm,第159行:把修改为: (去除主题列表页上方的那个返回按钮中的forum.php尾巴)</p>
<p>forumdisplay_list.htm, 第 332行:把《a href=&rdquo;forum.php&rdquo;》修改为: (去除主题列表页下方分页导航前面的那个返回按钮中的forum.php尾巴)</p>
<p><strong>(5)在/source/archiver/forum/中</strong></p>
<p>discuz.php的第24行,把修改为</p>
<p><strong>(6)设置301重定向</strong></p>
<p>RewriteEngine on</p>
<p>RewriteCond %{http_host} ^(.+)\.域名com </p>
<p>RewriteRule ^(.*)$ http://www.域名.com/ </p>
<p>RewriteRule ^(.*)\/forum.php$ http://www.域名.com/ </p>
<p>通过以上六部操作,就可以完美的去掉disciz论坛中forum.php的尾巴了。这样做的目的是为了让网站URL标准化,有利于网站优化。</p>
<p>本文首发sem学院:http://www.semxyz.com</p>
<p>版权所有,转载请以链接形式注明作者及原始出处。</p>
<p></p>
頁: [1]
查看完整版本: Discuz! x2去除forum.php尾巴的方法小结