Discuz! x2去除forum.php尾巴的方法小结
<p>首先声明:这是一篇去除discuz论坛中forum.php尾巴最全的方法,之前也看到过类似的文章,但按照步骤操作后,大家会发现还有很多地方没有去掉forum.php尾巴。这样不利于网站seo。今天,为大家整理了最完美的去除forum.php尾巴的方法。</p><p>在操作之前,我们先来看一下discuz论坛含有forum.php尾巴的地方:</p>
<p>(1)主导航中的论坛按钮</p>
<p style="TEXT-ALIGN: center"><img height="62" alt="主导航论坛按钮" width="395" border="0" src="https://img.jbzj.com/file_images/article/201204/201204011154227.jpg" /></p>
<p>(2)论坛首页的面包屑导航位置</p>
<p>(3)分区版块的面包屑导航位置</p>
<p>(4)主题列表页的面包屑导航位置</p>
<p>(5)主题内容页的面包屑导航位置</p>
<p style="TEXT-ALIGN: center"><img height="229" alt="面包屑导航" width="563" border="0" src="https://img.jbzj.com/file_images/article/201204/201204011154228.jpg" /></p>
<p>(6)发新主题页面包屑导航位置</p>
<p>(7)主题列表页的2个返回按钮</p>
<p style="TEXT-ALIGN: center"><img height="231" alt="主题内容页两个返回按钮" width="614" border="0" src="https://img.jbzj.com/file_images/article/201204/201204011154229.jpg" /></p>
<p>(8)archiver/的首页</p>
<p style="TEXT-ALIGN: center"><img height="61" alt="acchiver首页" width="253" border="0" src="https://img.jbzj.com/file_images/article/201204/2012040111542210.jpg" /></p>
<p>(9)输入域名默认跳转到带有www.域名.com/forum.php</p>
<p>既然知道了,discuz论坛都是那些地方含有forum.php,接下来就按照以下步骤来逐一去除</p>
<p><strong>(1)在后台设置域名</strong></p>
<p style="TEXT-ALIGN: center"><img height="360" alt="域名设置" width="443" border="0" src="https://img.jbzj.com/file_images/article/201204/2012040111542211.jpg" /></p>
<p>这步设置之后,主导航中的论坛按钮就去掉了forum.php尾巴</p>
<p><strong>(2)在template\default\forum中找到discuz.htm,大约在第19行的位置,</strong></p>
<p>把<a href="forum.php">修改为:<a href="http://$_G['setting']['domain']['app']['forum']/"></p>
<p>这样,首页和分区版块的面包屑导航中的forum.php就去掉了。</p>
<p><strong>(3)在/source/module/forum/中</strong></p>
<p>forum_forumdisplay.php,第65、67、74、76行:把<a href="forum.php">修改为:<a href="./"> (去除主题列表页面包屑导航位置的forum.php尾巴)</p>
<p>forum_viewthread.php,第107行:把<a href="forum.php">修改为:<a href="./"> (去除主题内容页面包屑导航位置的forum.php尾巴)</p>
<p>forum_post.php,第111行:把<a href="forum.php">修改为:<a href="./">(去除主题发心主题面包屑导航位置的forum.php尾巴)</p>
<p>forum_misc.php,第394、398行:把<a href="forum.php">修改为:<a href="./"> (这个应该是手机版的)</p>
<p><strong>(4)/template/default/forum/ 中</strong></p>
<p>forumdisplay.htm,第159行:把<a href="forum.php">修改为:<a href="http://$_G['setting']['domain']['app']['forum']/"> (去除主题列表页上方的那个返回按钮中的forum.php尾巴)</p>
<p>forumdisplay_list.htm, 第 332行:把《a href=”forum.php”》修改为:<a href=http://$_G['setting']['domain']['app']['forum']/> (去除主题列表页下方分页导航前面的那个返回按钮中的forum.php尾巴)</p>
<p><strong>(5)在/source/archiver/forum/中</strong></p>
<p>discuz.php的第24行,把<a href="../forum.php" target="_blank">修改为<a href="../" target="_blank"></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>
頁:
[1]