<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[Discuz论坛SEO优化修改]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[搜索优化]]></category>
<pubDate>Sat, 02 Sep 2006 23:49:53 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	*********************************************<br/>纯属本人原创，原载于落伍论坛<br/>*********************************************<br/>众所周知，Discuz在SEO优化上做的并不是很好，很网友反应需要这方面的支持，我把自己做的一些简单的优化措施，贡献给大家，希望借此能够落伍。<br/>为修改前，Discuz的标题栏显示的是：网站名--版块名--文章名，有点SEO方面知识的人都知道，这样不利于搜索爬虫搜索到，精明做法就是让它显示的时候，如下：文章名--版块名--网站名。（本人是在Discuz4.1.0版本上修改的）<br/>具体修改如下：<br/>forumdisplay.php<br/>====================================<br/><br/>if($forum[&#039;type&#039;] == &#039;forum&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» $forum[name]&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = &#039; - &#039;.strip_tags($forum[&#039;name&#039;]);<br/>} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$forumup = $_DCACHE[&#039;forums&#039;][$forum[&#039;fup&#039;]][&#039;name&#039;];<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$forum[fup]&#92;&quot;&gt;$forumup&lt;/a&gt; » $forum[name]&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = &#039; - &#039;.strip_tags($forumup).&#039; - &#039;.strip_tags($forum[&#039;name&#039;]);<br/>}<br/><br/><br/>修改为：<br/><br/><br/>if($forum[&#039;type&#039;] == &#039;forum&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» $forum[name]&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = strip_tags($forum[&#039;name&#039;]);<br/>} else {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$forumup = $_DCACHE[&#039;forums&#039;][$forum[&#039;fup&#039;]][&#039;name&#039;];<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$forum[fup]&#92;&quot;&gt;$forumup&lt;/a&gt; » $forum[name]&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = strip_tags($forumup).&#039; - &#039;.strip_tags($forum[&#039;name&#039;]);<br/>}<br/><br/><br/>============================================================<br/><br/><br/><br/>viewthread.php<br/>================================================<br/><br/>$navtitle = &#039; - &#039;.strip_tags($forum[&#039;name&#039;]).&#039; - &#039;.$thread[&#039;subject&#039;];<br/>if($forum[&#039;type&#039;] == &#039;sub&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT fid, name FROM {$tablepre}forums WHERE fid=&#039;$forum[fup]&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fup = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fup[fid]&#92;&quot;&gt;$fup[name]&lt;/a&gt; $navigation&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = &#039; - &#039;.strip_tags($fup[&#039;name&#039;]).$navtitle;<br/>}<br/><br/><br/>修改为：<br/><br/><br/>$navtitle = $thread[&#039;subject&#039;].&#039; - &nbsp;&#039;.strip_tags($forum[&#039;name&#039;]);<br/>if($forum[&#039;type&#039;] == &#039;sub&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT fid, name FROM {$tablepre}forums WHERE fid=&#039;$forum[fup]&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fup = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fup[fid]&#92;&quot;&gt;$fup[name]&lt;/a&gt; $navigation&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = $navtitle;<br/>}<br/><br/><br/><br/>post.php<br/>====================================================<br/><br/>if(!empty($tid) &amp;&amp; !empty($fid)) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT * FROM {$tablepre}threads WHERE tid=&#039;$tid&#039; AND displayorder&gt;=&#039;0&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$thread = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fid = $thread[&#039;fid&#039;];<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;viewthread.php?tid=$tid&#92;&quot;&gt;$thread[subject]&lt;/a&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = &quot; - $thread[subject]&quot;;<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp;if($thread[&#039;readperm&#039;] &amp;&amp; $thread[&#039;readperm&#039;] &gt; $readaccess &amp;&amp; !$forum[&#039;ismoderator&#039;] &amp;&amp; $thread[&#039;authorid&#039;] != $discuz_uid) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showmessage(&#039;thread_nopermission&#039;, NULL, &#039;NOPERM&#039;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/>}<br/><br/>$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fid&quot;.($extra ? &#039;&amp;&#039;.preg_replace(&quot;/^(&amp;)*/&quot;, &#039;&#039;, $extra) : &#039;&#039;).&quot;&#92;&quot;&gt;$forum[name]&lt;/a&gt; $navigation&quot;;<br/>$navtitle = &#039; - &#039;.strip_tags($forum[&#039;name&#039;]).$navtitle;<br/>if($forum[&#039;type&#039;] == &#039;sub&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT name, fid FROM {$tablepre}forums WHERE fid=&#039;$forum[fup]&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fup = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fup[fid]&#92;&quot;&gt;$fup[name]&lt;/a&gt; $navigation&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = &#039; - &#039;.strip_tags($fup[&#039;name&#039;]).$navtitle;<br/>}<br/><br/><br/><br/>修改为：<br/><br/><br/>if(!empty($tid) &amp;&amp; !empty($fid)) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT * FROM {$tablepre}threads WHERE tid=&#039;$tid&#039; AND displayorder&gt;=&#039;0&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$thread = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fid = $thread[&#039;fid&#039;];<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;viewthread.php?tid=$tid&#92;&quot;&gt;$thread[subject]&lt;/a&gt;&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = $thread[subject];<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp;if($thread[&#039;readperm&#039;] &amp;&amp; $thread[&#039;readperm&#039;] &gt; $readaccess &amp;&amp; !$forum[&#039;ismoderator&#039;] &amp;&amp; $thread[&#039;authorid&#039;] != $discuz_uid) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showmessage(&#039;thread_nopermission&#039;, NULL, &#039;NOPERM&#039;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/>}<br/><br/>$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fid&quot;.($extra ? &#039;&amp;&#039;.preg_replace(&quot;/^(&amp;)*/&quot;, &#039;&#039;, $extra) : &#039;&#039;).&quot;&#92;&quot;&gt;$forum[name]&lt;/a&gt; $navigation&quot;;<br/>$navtitle = strip_tags($forum[&#039;name&#039;]).$navtitle;<br/>if($forum[&#039;type&#039;] == &#039;sub&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp;$query = $db-&gt;query(&quot;SELECT name, fid FROM {$tablepre}forums WHERE fid=&#039;$forum[fup]&#039;&quot;);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$fup = $db-&gt;fetch_array($query);<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navigation = &quot;» &lt;a href=&#92;&quot;forumdisplay.php?fid=$fup[fid]&#92;&quot;&gt;$fup[name]&lt;/a&gt; $navigation&quot;;<br/> &nbsp; &nbsp; &nbsp; &nbsp;$navtitle = $navtitle;<br/>}<br/><br/><br/><br/><br/><br/><br/>./temlpates/default/header.htm<br/>=======================================================<br/><br/>&lt;title&gt;$bbname $seotitle $navtitle - powered by Discuz!&lt;/title&gt;<br/>修改为：<br/><br/><br/>&lt;title&gt;&lt;!--{if $navtitle}--&gt;$navtitle - $bbname&lt;!--{else}--&gt;$bbname&lt;!--{/if}--&gt; &lt;/title&gt;<br/><br/>=============================================================<br/><br/>如果大家觉得自己修改麻烦的话，可以直接下载我修改过的这几个文件，不过里面不包含header.htm的修改，因为大家用的模板不同，只须将所用模板修改即可。<br/>下载地址：<br/>http://www.dzhope.com/dzhope.rar<br/>演示网站：http://bbs.dzhope.com <br/><br/>Tags - <a href="http://www.dzhope.com/tags/discuz/" rel="tag">discuz</a> , <a href="http://www.dzhope.com/tags/seo%25E4%25BC%2598%25E5%258C%2596/" rel="tag">seo优化</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] Discuz论坛SEO优化修改]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>