<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>木客网 &#187; WordPress</title>
	<atom:link href="http://woodfeed.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://woodfeed.com</link>
	<description></description>
	<lastBuildDate>Wed, 09 Jun 2010 12:15:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>wp主题k2</title>
		<link>http://woodfeed.com/wp-k2/</link>
		<comments>http://woodfeed.com/wp-k2/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 06:26:08 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[k2]]></category>
		<category><![CDATA[wp k2]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=522</guid>
		<description><![CDATA[k2是一款功能强大且外观易于定制的主题。]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">今天 k2 更新了，有两个月没更新过了。</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">K2是WordPress的一个优秀主题，它由Michael Heilemann（WordPress Default themes 的作者</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">）, Chris J Davis, Zeo, Steve Lam 和 Ben Sherratt 共同开发。</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">这次有较大的更改。</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">r818</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Removed the TextMate project file.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Removed the &#8216;vader&#8217; style, which is old and rarely updated anyway.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Oh hai. First commit in ages; sorry about that. No promises though.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">r819</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Removed &#8216;widgets manager&#8217; option from the options page.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">r820</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Changed the font-family on the sidebar headlines. Always hated the Trebuchet in</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">that size.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">r821</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Updated the CSS meta info for dueling sidebars</div>
<div><a href="http://getk2.com">K2</a>是WordPress的一个优秀主题，它功能强大，且外观易于定制<span style="background-color: #ffffff;">。</span>它由<a href="http://binarybonsai.com/">Michael Heilemann</a>（WordPress Default themes 的作者<span style="background-color: #ffffff; ">）,<span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif; line-height: 21px; font-size: 12px; color: #444444; "> <span style="background-color: #ffffff; "> <a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2277dd; text-decoration: none; " onclick="javascript:urchinTracker('/outbound/chrisjdavis.org?ref=/');" href="http://chrisjdavis.org/">Chris J Davis</a>，<span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; font-size: 13px; "><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif; line-height: 21px; font-size: 12px; color: #444444; "> <a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2277dd; text-decoration: none; " onclick="javascript:urchinTracker('/outbound/zeo.unic.net.my/?ref=/');" href="http://zeo.unic.net.my/">Zeo</a>， <a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2277dd; text-decoration: none; " onclick="javascript:urchinTracker('/outbound/stevelam.org/?ref=/');" href="http://stevelam.org/">Steve Lam</a> 和 <a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2277dd; text-decoration: none; " onclick="javascript:urchinTracker('/outbound/nybblelabs.org.uk?ref=/');" href="http://nybblelabs.org.uk/">Ben Sherratt</a> </span>共同开发。</span></span></span></span></div>
<div><strong>特色：</strong></div>
<div>
<div>Ajax翻页和搜索，动态的边栏（不同页面显示不同边框），支持评论嵌套和分页，支持单栏/双栏/三栏/自适应这<span style="background-color: #ffffff;">，存档页面。</span></div>
<div><span style="background-color: #ffffff;"><br />
</span></div>
</div>
<div><span style="font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Tahoma, Arial; color: #444444; font-size: medium;"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; background-color: #ffffff;">今天 k2 更新了，有两个月没更新过了。</span></span></div>
<div>这次有较大的更改。</div>
<div>r818</div>
<div>Removed the TextMate project file.</div>
<div>Removed the &#8216;vader&#8217; style, which is old and rarely updated anyway.</div>
<div>Oh hai. First commit in ages; sorry about that. No promises though.</div>
<div>r819</div>
<div>Removed &#8216;widgets manager&#8217; option from the options page.</div>
<div>r820</div>
<div>Changed the font-family on the sidebar headlines. Always hated the Trebuchet in <span style="background-color: #ffffff; ">that size.</span></div>
<div>r821</div>
<div>Updated the CSS meta info for dueling sidebars.</div>
<div style="text-align: center;"><a href="http://woodfeed.com/wp-content/uploads/2009/12/k2.jpg" rel="lightbox[522]"><img class="size-full wp-image-527 alignnone" title="k2" src="http://woodfeed.com/wp-content/uploads/2009/12/k2.jpg" alt="k2" width="300" height="225" /></a></div>
<div style="text-align: center; "><a href="http://getk2.com/nightly/" target="_blank">下载</a> | <span style="background-color: #ffffff; "><a href="http://getk2.com/" target="_blank">demo</a></span></div>
<div><span style="background-color: #ffffff; "><br />
</span></div>
<h2  class="related_post_title">精彩文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/mcu-c8051f020-and-mcu-80c51/" title="C8051F020与80C51单片机的异同点">C8051F020与80C51单片机的异同点</a><br /><small>80C51系列单片机及其衍生产品在我国乃至全世界范围获得了非常广泛的应用。单片机领域的大...</small></li><li><a href="http://woodfeed.com/optical-encoder-features-and-applications/" title="光电编码器的特性及应用">光电编码器的特性及应用</a><br /><small>光电编码器，是一种通过光电转换将输出轴上的机械几何位移量转换成脉冲或数字量的传感器。这是...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-2/" title="Linux常用命令详解(2)">Linux常用命令详解(2)</a><br /><small>三 文件管理
1.Diff  2. find  3. ln  4.locate  5. ...</small></li><li><a href="http://woodfeed.com/autotools-generated-makefile/" title="利用autotools生成Makefile">利用autotools生成Makefile</a><br /><small>对于一个较大的项目而言，完全手动建立Makefile是一件费力而又容易出错的工作。aut...</small></li><li><a href="http://woodfeed.com/next-page-bug-of-404-for-pseudo-static/" title="win主机404实现伪静态翻页错误">win主机404实现伪静态翻页错误</a><br /><small>bug：翻过一次页面时，第二次翻页链接地址提取出错。
例如：page/2，点击3，出来的...</small></li><li><a href="http://woodfeed.com/local-area-network/" title="局域网">局域网</a><br /><small>主要内容：1、局域网定义和特性 　2、各种流行的局域网技术  3、高速局域网技术  4、...</small></li><li><a href="http://woodfeed.com/my-alexa-ranking-updated-today/" title="3天后的今天alexa又更新了">3天后的今天alexa又更新了</a><br /><small>今天排名又更新了。



...</small></li><li><a href="http://woodfeed.com/yigeshidaidejieshu/" title="迈克尔-杰克逊逝世 一个时代的结束">迈克尔-杰克逊逝世 一个时代的结束</a><br /><small>“据2006年底统计，其正版专辑全球销量已超过7.5亿，被载入“吉尼斯世界记录大全”。他...</small></li><li><a href="http://woodfeed.com/photoshop-box/" title="PhotoShop作业&#8211;盒子">PhotoShop作业&#8211;盒子</a><br /><small>
 
去年做的一个作业，ps的处女作。...</small></li><li><a href="http://woodfeed.com/2007-national-electronic-design-competition-f/" title="2007全国电子设计大赛F题(电动车跷跷板)">2007全国电子设计大赛F题(电动车跷跷板)</a><br /><small>2007全国电子设计大赛F题 

电动车跷跷板（F题）

一、任务



设计并制作一个...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/wp-k2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>win主机404实现伪静态翻页错误</title>
		<link>http://woodfeed.com/next-page-bug-of-404-for-pseudo-static/</link>
		<comments>http://woodfeed.com/next-page-bug-of-404-for-pseudo-static/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 06:52:07 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[伪静态]]></category>
		<category><![CDATA[翻页错误]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=384</guid>
		<description><![CDATA[bug：翻过一次页面时，第二次翻页链接地址提取出错。
例如：page/2，点击3，出来的地址是一个转向404页面之后的地址。
修正：打开根目录下的wp-settings.php。查找下面一行代码]]></description>
			<content:encoded><![CDATA[<p>bug：翻过一次页面时，第二次翻页链接地址提取出错。<br />
例如：page/2，点击3，出来的地址是一个转向404页面之后的地址。<br />
修正：打开根目录下的wp-settings.php。查找下面一行代码</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">php_sapi_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'cgi-fcgi'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'/^Microsoft-IIS\//'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SERVER_SOFTWARE'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>替换为：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>这样就OK了。</p>
<h2  class="related_post_title">精彩文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/all-commands-about-the-vi-editor-under-linux/" title="linux下Vi编辑器命令大全">linux下Vi编辑器命令大全</a><br /><small>文本编辑器是所有计算机系统中最常用的一种工具。UNIX下的编辑器有ex,sed和vi等，...</small></li><li><a href="http://woodfeed.com/network-cabling-various-test-methods/" title="网络布线:多种测试方法">网络布线:多种测试方法</a><br /><small>【简 介】 
网络在迅猛发展，使用网络的用户也越来越多。随着用户对网络依赖程度的增加，...</small></li><li><a href="http://woodfeed.com/uip-uipopt-h-configuration-2/" title="uIP &#8211; uipopt.h配置">uIP &#8211; uipopt.h配置</a><br /><small>使用每个项目一个的配置文件uipopt.h来配置uIP。这个文件包含了uIP的所有的编译...</small></li><li><a href="http://woodfeed.com/a-new-domain-name-laeon-com/" title="注册了一个域名laeon.com">注册了一个域名laeon.com</a><br /><small>前几天又去注册了一个域名，在雅虎注册的，2刀。准备过2个月转出去~
这个比较短，五个字...</small></li><li><a href="http://woodfeed.com/uip-transplantation/" title="uIP移植">uIP移植</a><br /><small>uIP的设备驱动程序接口。uIP内核中有两个函数直接需要底层设备驱动程序的支持。一是ui...</small></li><li><a href="http://woodfeed.com/vmware-virtual-machine-under-linux-network/" title="VMWare虚拟机下linux联网">VMWare虚拟机下linux联网</a><br /><small>VMWare虚拟机下安装的RedHat 9.0 linux有三种方式实现上网，桥接、na...</small></li><li><a href="http://woodfeed.com/robot-control-of-linear-maze/" title="浅谈机器人在线迷宫中的控制策略问题">浅谈机器人在线迷宫中的控制策略问题</a><br /><small>循迹存在一些直道、弯道、丁字路口、十字路口、死胡同等多种情况。在“左手法则”下，如何合理...</small></li><li><a href="http://woodfeed.com/photoshop-box/" title="PhotoShop作业&#8211;盒子">PhotoShop作业&#8211;盒子</a><br /><small>
 
去年做的一个作业，ps的处女作。...</small></li><li><a href="http://woodfeed.com/interconnection-technology/" title="网络互连技术">网络互连技术</a><br /><small>主要内容：1、局域网互连 
　2、网络互连原理 
　3、无连接网络互连、各种路由选择...</small></li><li><a href="http://woodfeed.com/implementing-16-bit-pwm-using-the-pca-with-c8051f020/" title="C8051f020产生16位PWM">C8051f020产生16位PWM</a><br /><small>脉冲宽度调制（PWM）波形常用于闭环反馈和控制应用，例如：控制加热单元的开关状态以调节D...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/next-page-bug-of-404-for-pseudo-static/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Apache mod_rewrite 实现301重定向</title>
		<link>http://woodfeed.com/apache-mod_rewrite-for-301-redirect/</link>
		<comments>http://woodfeed.com/apache-mod_rewrite-for-301-redirect/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 06:45:06 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=380</guid>
		<description><![CDATA[它提供了一个基于正则表达式分析器的重写引擎来实时重写URL请求。它支持每个完整规则可以拥有不限数量的子规则以及附加条件规则的灵活而且强大的URL操作机制。此URL操作可以依赖于各种测试，比如服务器变量、环境变量、HTTP头、时间标记，甚至各种格式的用于匹配URL组成部分的查找数据库。

此模块可以操作URL的所有部分(包括路径信息部分)，在服务器级的(httpd.conf)和目录级的(.htaccess)配置都有效，还可以生成最终请求字符串。此重写操作的结果可以是内部子处理，也可以是外部请求的转向，甚至还可以是内部代理处理。]]></description>
			<content:encoded><![CDATA[<p><strong>Apache mod_rewrite</strong><br />
它提供了一个基于正则表达式分析器的重写引擎来实时重写URL请求。它支持每个完整规则可以拥有不限数量的子规则以及附加条件规则的灵活而且强大的URL操作机制。此URL操作可以依赖于各种测试，比如服务器变量、环境变量、HTTP头、时间标记，甚至各种格式的用于匹配URL组成部分的查找数据库。</p>
<p>此模块可以操作URL的所有部分(包括路径信息部分)，在服务器级的(httpd.conf)和目录级的(.htaccess)配置都有效，还可以生成最终请求字符串。此重写操作的结果可以是内部子处理，也可以是外部请求的转向，甚至还可以是内部代理处理。</p>
<p><strong>mod_rewrite 实现301重定向<br />
</strong>1.只更换域名，后面的目录链接不变：</p>
<p><code># BEGIN WP<br />
Options +FollowSymLinks<br />
RewriteEngine On<br />
RewriteCond %{http_host} ^blog.woodfeed.com [NC]<br />
RewriteRule ^(.*)$ http://woodfeed.com/$1 [L,R=301]<br />
# END WP</code></p>
<p><code># BEGIN WP<br />
Options +FollowSymLinks<br />
RewriteEngine On<br />
RewriteCond %{http_host} ^blog\.woodfeed\.com$ [NC]<br />
RewriteRule ^(.*)$ http://woodfeed.com%{REQUEST_URI} [L,R=301]<br />
# END WP</code><br />
2.更换域名的同时，将伪静态页面的.html去掉<br />
本站blog.woodfeed.com就是用的下面代码实现的301定向。</p>
<p><code># BEGIN WP<br />
Options +FollowSymLinks<br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^([-a-zA-Z0-9_+]+).html$ http://woodfeed.com/$1 [L,R=301]<br />
RewriteRule ^(.*)$ http://woodfeed.com%{REQUEST_URI} [L,R=301]<br />
# END WP</code></p>
<p><strong>mod_rewrite 正则表达式<br />
</strong>现在我们可以重写URLs了！设想我们有一个显示城市信息的网站。根据URI选择城市：http://www.example.com/display.php?country=USA &amp;state=California&amp;city=San_Diego这个URL太长并且对用户也不友好，我们更希望写成这样：</p>
<p>http://www.example.com/USA/California/San_Diego</p>
<p>我们需要告诉Apache新的URL会根据一定的格式转化成这样，为了让display.php明白查询的字符，所以我们将用到正则表达式告诉 mod_rewrite匹配我们的URLs。如果你对正则表达式不太熟悉，许多网站提供了优秀的教程供你学习。在本文的末尾，我也会列举出比较好的参考网 址。如果你还是不能明白我所讲述的，那么我建议你看看后面链接中的前两篇。<br />
一个最常用的正则就是（.*）。它含有两个元素：一是“点”，表示任意字符；二是“星”，表示以前的全部字符。所以（.*）会匹配 {REQUEST_URI}的所有字符。{REQUEST_URI}是URL中出去域名以及“？”符号的所有查询字符，也是Apache 重写技术尝试匹配的字符。<br />
包裹在正则表达式中的元素存放在“原子”内，它是在规则范围内允许被匹配的变量，所以以上正则存储了USA/California/San_Diego在“原子”中，为了解决我们的问题，我们需要三个“原子”，他们可以用左斜杠“/”进行分隔，所以正则表达式成了：<br />
(.*)/(.*)/(.*)<br />
以上正则，在{REQUEST_URI}中通过两个“/”的分割存储了三个值，为了解决我们具体问题，我们得加一点限制――毕竟，第一个和最后一个原子可以匹配任何字符。<br />
开始，我们可以添加一些特殊的字符，比如表示正则“开始”或者“结束”，“^”字符表示正则的开始而“$”表示正则的结束。<br />
^(.*)/(.*)/(.*)$<br />
这个正则表示整个字符串将全部匹配，除去之前后者之后，没有任何例外。<br />
但是，这个方法仍然匹配的范围太广，我们将匹配的字符按照原子形式存放，然后通过他们形成查询字符串，所以我们必须信任我们所匹配的字符。用(.*)匹配字符串，由于允许了太多字符，所以会存在潜在的安全隐患，引用不当会使mod_rewrite运行出故障。<br />
为了避免一些不必要的麻烦，让我们更改一下我们的原子正则，让其更加准确的匹配我们允许的字符。因为这些原子代表了地区地名，所以我们完全可以用A到Z的 大小写来表示他们，另外因为地名之间有空格，所以下划线“_”也是被允许的。我们用中括弧明确我们匹配的正则，然后用短横线“-”表示连接的范围，所以被 我们允许的正则修改成了[a-zA-Z_],因为我们还要避免匹配到空名字，所以用“+”来匹配在该字符之前的一个或者多个字符，所以我们的正则成了：<br />
^([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$<br />
{REQUEST_URI}是以“/”开头。Apache 在更改版本的时候会更改正则引擎，一代Apache要求有斜杠而二代Apache却不允许！但是我们可以用^/?（？表示匹配字符本身或者前一个字符）来兼容两个版本的Apache，所以我们的正则又成了:<br />
^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$正则在手，我们就可以将原子标识到URL上了：display.php?country=$1 &amp;state=$2&amp;city=$3<br />
$1表示国家原子；$2表示省州原子；$3表示城市原子，这里可以加上9个原子，分别用$1到$9表示。<br />
现在我们要做的就是在该目录下创建一个新的.htaccess文件，录入一下代码：<br />
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$ display.php?country=$1 &amp;state=$2&amp;city=$3 [L]<br />
然后保存，重写规则必须写在一行并且用一个空格分开每一个参数，我们用[L]或者’last’表示匹配结束。（一会有更多flags介绍）我们的重写规则已经创建完成， URL请求字符上各原子的值将经过我们匹配的正则，加上查询变量到我们的重写URL上。display.php将从查询字符中解析这些值，然后将他们送入数据库查询或者进行其他数据库操作。<br />
如果你的正则只允许有限的几个国家，为了避免数据库错误，你可以在正则中加入一下被允许条件，例子如下：<br />
^/?(USA|Canada|Mexico)/([a-zA-Z_]+)/([a-zA-Z_]+)$<br />
如果你关心查询字符串的大小写问题，由于你数据库对大写有严格的限制，那么你可以在正则表达式后面加一个[NC]FLAG位来忽略大小写，但是不要忘记在你通过$_GET 获取传递值的时候，把他们转换成小写。<br />
如果你想用数字（0，1…..9）来表示具体的地区，那么需要更改正则中的([a-zA-Z_]+)成([0-9])来匹配单个数字，([0-9]{1,2})匹配两位数字（0到99）,([0-9]+)匹配多位数字，这个对匹配数据库ID之类的非常有用。</p>
<p><strong>RewriteCond 指令</strong><br />
当RewirteCond指令明确声明以后，mod_rewrite将根据它们做出相应的处理。<br />
RewirteCond 指令的形式和RewriteRule有点类似，形式为：RewirteCond 被匹配的字符正则 FLAG标识。逻辑FLAG标识 [OR],是非常有用的，记住所有RewirteCond 以及RewriteRule指令在[LAST]指令之前，所有的逻辑与关系都会被包含。<br />
你可以用RewirteCond指令测试服务器变量，在this is the best list of server variables一文可以找到相关说明。举一个列子，假设我们想将“www”放入你的域名中，首先你得测试你的服务器{HTTP_HOST}变量，看www.是否已经存在，如果没有那么定向到期望的主机名：<br />
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]<br />
RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]<br />
这里{HTTP_HOST}是一个Apache服务器变量，我们必须加一个“%”字符再之前。正则表达式以“!”开始表示如果正则不匹配那么条件成立。我 们当然也要转义“.”字符，将其作为一个普通字面字符而不是表示所有字符。再最后我们还加了一个忽略大小写的[NC]FLAG。<br />
RewriteRule匹配了零或者任意一个字符，并且定向到http://www.example.com加上原来{REQUEST_URI}值。R=301向服务器提出301请求，表明这是一个永久转向，最后一个[L]表示已经完成这段正则匹配。<br />
RewriteCond也可以创建原子，在RewriteRule中原子是以$1…..$9表示，但是在RewriteCond中是以%1….%9表示。</p>
<p><strong>mod_rewrite注释<br />
</strong>任何mod_rewrite代码之前都要加上RewriteEngine on这个状态，另外RewriteEngine on还可以用到其他地方。作为一个好的程序员，你知道注释对于程序来说是多么的重要。</p>
<p>mod_rewrite允许在RewriteEngine off 与RewriteEngine on之间加上你的注释：<br />
RewriteEngine off<br />
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]<br />
RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]<br />
RewriteEngine on<br />
以上所有的程序代码都不会被执行，RewriteEngine状态值的改变对新的mod_rewrite 代码开发非常有用。像你在PHP里面用/* &#8230; */注释一样，好好的运用他们。</p>
<p><strong>例子：用新的格式展示当前URI<br />
</strong>如果这就是我们当前正在运行的URLs：/index.php?id=nnnn。我们非常希望将其更改成/nnnn并且让搜索引擎以新格式展现。首先，我 们为了让搜索引擎更新成新的，得将旧的URLs重定向到新的格式，但是，我们还得保证以前的index.php照样能够运行。是不是被我搞迷糊了？<br />
实现以上功能，诀窍就在于在查询变量中加了一个访问者看不到的标记符“marker”。我们只将查询变量中没有出现“marker”标记的链接进行重定 向，然后将原有的链接替换成新的格式，并且通过[QSA]FLAG在已有的参数加一个“marker”标记。以下为实现的方式：<br />
RewriteCond %{QUERY_STRING} !marker<br />
RewriteCond %{QUERY_STRING} id=([-a-zA-Z0-9_+]+)<br />
RewriteRule ^/?index\.php$ %1? [R=301,L]<br />
RewriteRule ^/?([-a-zA-Z0-9_+]+)$ index.php?marker &amp;id=$1 [L]<br />
这里，原先的URL：http://www.example.com/index.php?id=nnnn,不包含marker，所以被第一个规则永久重 定向到http://www.example.com/nnnn，第二个规则将http://www.example.com/nnnn反定向到 http://www.example.com/index.php?marker &amp;id=nnnn，并且加了marker以及id=nnnn两个变量，最后mod_rewrite就开始进行处理过程。<br />
第二次匹配，marker被匹配，所以忽略第一条规则，这里有一个“.”字符会出现在http://www.example.com/index.php?marker &amp;id=nnnn中，所以第二条规则也会被忽略，这样我们就完成了。<br />
注意，这个解决方案要求Apache的一些扩展功能，所以如果你的网站放于在共享主机中会遇到很多障碍。<br />
了解更多：http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_rewrite.html</p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/php-code-for-301-redirect/" title="简单PHP代码实现301地址重定向">简单PHP代码实现301地址重定向</a><br /><small>重定向就是将网页自动转向重定向，即：301永久性重定向和302临时性重定向。实施301后...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/apache-mod_rewrite-for-301-redirect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>简单PHP代码实现301地址重定向</title>
		<link>http://woodfeed.com/php-code-for-301-redirect/</link>
		<comments>http://woodfeed.com/php-code-for-301-redirect/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 10:57:23 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[301 redirect]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=379</guid>
		<description><![CDATA[重定向就是将网页自动转向重定向，即：301永久性重定向和302临时性重定向。实施301后，新网址完全继承旧网址，旧网址的排名等完全清零；实施302后，对旧网址没有影响，但新网址不会有排名。]]></description>
			<content:encoded><![CDATA[<p>重定向就是将网页自动转向重定向，即：301永久性重定向和302临时性重定向。实施301后，新网址完全继承旧网址，旧网址的排名等完全清零；实施302后，对旧网址没有影响，但新网址不会有排名。<br />
　　<br />
　　301 Redirect 永久重定向的实现<br />
　　<br />
　　在我们的网站建设中，时常会遇到需要网页重定向的情况：象网站调整，如改变网页目录结构，网页被移到一个新地址，再或者，网页扩展名改变，如因应用需要把.php改成.Html或.shtml，在这种情况下，如果不做重定向，则用户收藏夹或搜索引擎数据库中旧地址只能让访问客户还会得到一个404页面错误信息，访问流量白白丧失；再如某些注册了多个域名的网站，也需要通过重定向让访问这些域名的用户自动跳转到主站点，等等。<br />
　　<br />
　　常用的重定向方式有: 301 redirect、302 redirect 与 meta fresh：<br />
　　<br />
　　301 redirect——301代表永久性转移(Permanently Moved)，301重定向是网页更改地址后对搜索引擎友好的最好方法，只要不是暂时搬移的情况,都建议使用301来做转址。<br />
　　<br />
　　302 redirect——302代表暂时性转移(Temporarily Moved )，在前些年，不少Black Hat SEO曾广泛应用这项技术作弊，目前，各大主要搜索引擎均加强了打击力度，象Google前些年对Business.com以及近来对BMW德国网站的惩罚。即使网站客观上不是spam，也很容易被搜寻引擎容易误判为spam而遭到惩罚。<br />
　　<br />
　　meta fresh——这在2000年前比较流行，不过现在已很少见。其具体是通过网页中的meta指令，在特定时间后重定向到新的网页，如果延迟的时间太短(约5秒之內)，会被判断为spam。</p>
<p>PHP实现301重定向：<br />
我原来的用的是Win主机，域名为&lt;a href=”http://blog.woodfeed.com”&gt;http://blog.woodfeed.com&lt;/a&gt;，用404实现的伪静态链接，所以真是域名为&lt;a href=”http://blog.woodfeed.com/404;http://blog.woodfeed.com:80/****/***.html”&gt;http://blog.woodfeed.com/404;http://blog.woodfeed.com:80/****/***.html&lt;/a&gt;样式的。现在要更改为：&lt;a href=”http://woodfeed.com/XXXXX”&gt;http://woodfeed.com/XXXXX&lt;/a&gt;，即直接加文章名的样式。<br />
具体显示如下：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span>p
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;HTTP/1.1 301 Moved Permanently&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$string1</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//取出域名http://blog.woodfeed.com后面的字符串</span>
<span style="color: #000088;">$string2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;404;http://blog.woodfeed.com:80/&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$string1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 将其中的404内容部分删除</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.html&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$string2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//去除后面的 .html</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://woodfeed.com/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//终止掉程序的运行</span>
<span style="color: #339933;">--&gt;</span></pre></div></div>

<p><strong>将以上代码加到打开网页时最先执行的php文件中，比如WordPress中当前使用主题的header.php</strong></p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/apache-mod_rewrite-for-301-redirect/" title="Apache mod_rewrite 实现301重定向">Apache mod_rewrite 实现301重定向</a><br /><small>它提供了一个基于正则表达式分析器的重写引擎来实时重写URL请求。它支持每个完整规则可以拥...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/php-code-for-301-redirect/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WP更换域名</title>
		<link>http://woodfeed.com/wp-replacement-of-domain-names/</link>
		<comments>http://woodfeed.com/wp-replacement-of-domain-names/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 10:10:45 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp更换域名]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=372</guid>
		<description><![CDATA[首先进入MySQL后台phpMyAdmin： 点结构体旁边的SQL按钮，在下面命令框内分别输入下面3条语句，执行。 1.修改option_value里的siteurl和home地址：  /*以默认表头wp_为例,http://blog.woodfeed.com为旧域名，http://woodfeed.com为新域名，下同。*/ UPDATE wp_options SET option_value = replace(option_value,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;) WHERE option_name = ‘home’ OR option_name = ’siteurl’;  2.修正文章中附件的地址： UPDATE wp_posts SET post_content = replace(post_content,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;); 3.修正wordpress文章默认的永久链接： UPDATE wp_posts SET guid = replace(guid,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;); 精彩文章交换技术主要内容：1、线路交换 　2、分组交换 　3、帧中继交换 　4、信元交换...电脑蓝屏代码00000001 不正确的函数。 2 0×00000002 系统找不到指定的档案。 ...注册了一个域名laeon.com前几天又去注册了一个域名，在雅虎注册的，2刀。准备过2个月转出去~ 这个比较短，五个字...Apache mod_rewrite 实现301重定向它提供了一个基于正则表达式分析器的重写引擎来实时重写URL请求。它支持每个完整规则可以拥...光电编码器的特性及应用光电编码器，是一种通过光电转换将输出轴上的机械几何位移量转换成脉冲或数字量的传感器。这是...网络安全与信息安全主要内容：1、密码学、鉴别 　2、访问控制、计算机病毒 　3、网络安全技术 ...VMWare虚拟机下linux联网VMWare虚拟机下安装的RedHat 9.0 linux有三种方式实现上网，桥接、na...浅谈机器人在线迷宫中的控制策略问题循迹存在一些直道、弯道、丁字路口、十字路口、死胡同等多种情况。在“左手法则”下，如何合理...uIP &#8211; uipopt.h配置使用每个项目一个的配置文件uipopt.h来配置uIP。这个文件包含了uIP的所有的编译...win主机404实现伪静态翻页错误bug：翻过一次页面时，第二次翻页链接地址提取出错。 例如：page/2，点击3，出来的...]]></description>
			<content:encoded><![CDATA[<p>首先进入MySQL后台phpMyAdmin：<br />
点结构体旁边的SQL按钮，在下面命令框内分别输入下面3条语句，执行。</p>
<p>1.修改option_value里的siteurl和home地址：</p>
<p> /*以默认表头wp_为例,http://blog.woodfeed.com为旧域名，<a href="http://woodfeed.com/">http://woodfeed.com</a>为新域名，下同。*/<br />
UPDATE wp_options SET option_value = replace(option_value,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;) WHERE option_name = ‘home’ OR option_name = ’siteurl’; </p>
<p>2.修正文章中附件的地址：</p>
<p>UPDATE wp_posts SET post_content = replace(post_content,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;);</p>
<p>3.修正wordpress文章默认的永久链接：</p>
<p>UPDATE wp_posts SET guid = replace(guid,&#8217;http://blog.woodfeed.com&#8217;,'http://woodfeed.com&#8217;);</p>
<h2  class="related_post_title">精彩文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/internet-control-message-protocol-icmp/" title="网际控制报文协议ICMP">网际控制报文协议ICMP</a><br /><small>ICMP协议是一个非常重要的协议，它对于网络安全具有极其重要的意义。（RFC-792）I...</small></li><li><a href="http://woodfeed.com/standard-acquisition-resolution-of-video-capture-device/" title="视频采集设备的标准采集分辨率">视频采集设备的标准采集分辨率</a><br /><small>QCIF全称Quarter common intermediate format。QCI...</small></li><li><a href="http://woodfeed.com/incremental-pid-algorithm/" title="增量式PID算法">增量式PID算法</a><br /><small>所谓增量式PID是指数字控制器的输出只是控制量的增量kuΔ。当执行机构需要的控制量是增量...</small></li><li><a href="http://woodfeed.com/%e8%ae%a4%e9%a2%86%e5%8d%9a%e5%ae%a2/" title="认领博客">认领博客</a><br /><small>QQREADER5A506122C50B4B1D...</small></li><li><a href="http://woodfeed.com/detailed-description-of-linux-network-configuration/" title="Linux网络配置详解">Linux网络配置详解</a><br /><small>从linux诞生的那一天起,就注定了它的网络功能空前地强大.所以在linux系统中如何配...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-2/" title="Linux常用命令详解(2)">Linux常用命令详解(2)</a><br /><small>三 文件管理
1.Diff  2. find  3. ln  4.locate  5. ...</small></li><li><a href="http://woodfeed.com/internet/" title="Internet">Internet</a><br /><small>主要内容：1、internet体系结构 
　2、internet连接的方法 
　3、...</small></li><li><a href="http://woodfeed.com/address-resolution-protocol-arp-and-reverse-address-resolution-protocol-rarp/" title="地址解析协议ARP和反向地址解析协议RARP">地址解析协议ARP和反向地址解析协议RARP</a><br /><small>ARP，全称Address Resolution Protocol，中文名为地址解析协议...</small></li><li><a href="http://woodfeed.com/remote-control-system-based-on-avr-microcontroller/" title="基于AVR单片机的远程控制系统的研究">基于AVR单片机的远程控制系统的研究</a><br /><small>介绍了一种利用AVR单片机和RTL8019AS以太网控制器实现的RS232接口设备远程控...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-6/" title="Linux常用命令详解(6)">Linux常用命令详解(6)</a><br /><small>八 网络通迅
1 ifconfig 2 netconfig 3 netstat 4 pi...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/wp-replacement-of-domain-names/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress使用win主机出现的邮件问题</title>
		<link>http://woodfeed.com/mail-problem-in-windows-host-for-wp/</link>
		<comments>http://woodfeed.com/mail-problem-in-windows-host-for-wp/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 12:42:51 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[configure smtp]]></category>
		<category><![CDATA[win host]]></category>
		<category><![CDATA[wp mail smtp]]></category>
		<category><![CDATA[wp mail问题]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=298</guid>
		<description><![CDATA[邮件问题是很头痛的，我搞了N天，首先就是肯定用不了自带的mail()函数来发注册邮件和评论回复等，那么就要用一个插件了，比较出名的就那两三了。 首先说，wp-mail-smtp，若主机没开openssl，可以使用其他的如QQ、163等支持SMTP的邮箱。但是我用了，它测试可以成功发送邮件，就是注册邮件也可以收到，但是评论回复就不行了。我用的评论回复插件是 Mail to Commenter  。据说，WordPress带验证机制，要把管理员的邮箱和wp mail smtp设置的邮箱一样就可以了。这个我不知道是否是真的，反正我设置了也没成功。不过换了一个插件，有成功了，不知道与此有关没有。 我换的另一个smtp插件是：configure smtp 。okay，可以发送回复邮件了。此插件的使用要点就是发件人名称要和邮箱里面的名称一样。 精彩文章Linux常用命令详解(6)八 网络通迅 1 ifconfig 2 netconfig 3 netstat 4 pi...Linux常用命令详解(2)三 文件管理 1.Diff 2. find 3. ln 4.locate 5. ...利用autotools生成Makefile对于一个较大的项目而言，完全手动建立Makefile是一件费力而又容易出错的工作。aut...数字压缩编码技术 数字信号有很多优点，但当模拟信号数字化后其频带大大加宽，一路6MHz的普通电视信号数字...发放腾讯微博邀请码（每天更新）发放腾讯微博邀请码（每天更新）...让WordPress支持中文tag和链接有的人用文章名做固定链接（%postname%），但是汉字标题出来后，地址栏的链接就变为...交换技术主要内容：1、线路交换 　2、分组交换 　3、帧中继交换 　4、信元交换...一个WordPress建立多个独立WP博客共用一个WordPress 可以共用同一个数据库...Linux下NFS详解NFS(Network File System)是一种分布式文件系统，允许网络中的安装不...uIP TCP/IP协议栈在51系列单片机上的应用　uIP 协议栈是一种免费的可实现的极小的TCP/IP协议栈，可以使用于由8位或16位微...]]></description>
			<content:encoded><![CDATA[<p>邮件问题是很头痛的，我搞了N天，首先就是肯定用不了自带的mail()函数来发注册邮件和评论回复等，那么就要用一个插件了，比较出名的就那两三了。<br />
首先说，<a href="http://wordpress.org/extend/plugins/wp-mail-smtp/" target="_blank">wp-mail-smtp</a>，若主机没开openssl，可以使用其他的如QQ、163等支持SMTP的邮箱。但是我用了，它测试可以成功发送邮件，就是注册邮件也可以收到，但是评论回复就不行了。我用的评论回复插件是 Mail to Commenter  。据说，WordPress带验证机制，要把管理员的邮箱和wp mail smtp设置的邮箱一样就可以了。这个我不知道是否是真的，反正我设置了也没成功。不过换了一个插件，有成功了，不知道与此有关没有。<br />
我换的另一个smtp插件是：<a href="http://coffee2code.com/wp-plugins/configure-smtp/" target="_blank">configure smtp </a>。okay，可以发送回复邮件了。此插件的使用要点就是发件人名称要和邮箱里面的名称一样。</p>
<h2  class="related_post_title">精彩文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-1/" title="Linux常用命令详解(1)">Linux常用命令详解(1)</a><br /><small>一 文件传输
1. bye 2．ftp 3. ftpcount
二 备份压缩
1.tar...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-4/" title="Linux常用命令详解(4)">Linux常用命令详解(4)</a><br /><small>五 磁盘维护
1 mkfs(make file system)
六 系统设置
1 exp...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-5/" title="Linux常用命令详解(5)">Linux常用命令详解(5)</a><br /><small>七 系统管理
1 adduser 2 passwd 3 date 4 exit 5 f...</small></li><li><a href="http://woodfeed.com/detailed-description-of-commonly-used-linux-commands-6/" title="Linux常用命令详解(6)">Linux常用命令详解(6)</a><br /><small>八 网络通迅
1 ifconfig 2 netconfig 3 netstat 4 pi...</small></li><li><a href="http://woodfeed.com/support-the-chinese-tags-and-links-by-wordpress/" title="让WordPress支持中文tag和链接">让WordPress支持中文tag和链接</a><br /><small>有的人用文章名做固定链接（%postname%），但是汉字标题出来后，地址栏的链接就变为...</small></li><li><a href="http://woodfeed.com/tencent-micoblog-invite/" title="发放腾讯微博邀请码（每天更新）">发放腾讯微博邀请码（每天更新）</a><br /><small>发放腾讯微博邀请码（每天更新）...</small></li><li><a href="http://woodfeed.com/incremental-pid-algorithm/" title="增量式PID算法">增量式PID算法</a><br /><small>所谓增量式PID是指数字控制器的输出只是控制量的增量kuΔ。当执行机构需要的控制量是增量...</small></li><li><a href="http://woodfeed.com/switching-technology/" title="交换技术">交换技术</a><br /><small>主要内容：1、线路交换
　2、分组交换
　3、帧中继交换
　4、信元交换...</small></li><li><a href="http://woodfeed.com/standard-acquisition-resolution-of-video-capture-device/" title="视频采集设备的标准采集分辨率">视频采集设备的标准采集分辨率</a><br /><small>QCIF全称Quarter common intermediate format。QCI...</small></li><li><a href="http://woodfeed.com/detailed-description-of-linux-network-configuration/" title="Linux网络配置详解">Linux网络配置详解</a><br /><small>从linux诞生的那一天起,就注定了它的网络功能空前地强大.所以在linux系统中如何配...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/mail-problem-in-windows-host-for-wp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>让WordPress支持中文tag和链接</title>
		<link>http://woodfeed.com/support-the-chinese-tags-and-links-by-wordpress/</link>
		<comments>http://woodfeed.com/support-the-chinese-tags-and-links-by-wordpress/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 08:33:10 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP Links]]></category>

		<guid isPermaLink="false">http://woodfeed.com/?p=120</guid>
		<description><![CDATA[有的人用文章名做固定链接（%postname%），但是汉字标题出来后，地址栏的链接就变为一长串符号了，减少了可读性。经过多方取经，终于知道了不用插件只需简单的修改两句代码就可以支持汉字链接了。]]></description>
			<content:encoded><![CDATA[<p>有的人用文章名做固定链接（%postname%），但是汉字标题出来后，地址栏的链接就变为一长串符号了，减少了可读性。经过多方取经，终于知道了不用插件只需简单的修改两句代码就可以支持汉字链接了。</p>
<p>打开wp-includes文件夹，找到classes.php，修改其中的两行，如下。<br />
下面是截取第152行到159行（WordPress 2.8.2版本，其他版本可能位置不同，可用Ctrl+F查找$pathinfo = $_SERVER['PATH_INFO']来确定位置），其中改变的是153行、158行。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>152
153
154
155
156
157
158
159
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PATH_INFO'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PATH_INFO'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
	<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pathinfo_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pathinfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;%25&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pathinfo_array</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$req_uri</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$req_uri_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$req_uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>修改为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>152
153
154
155
156
157
158
159
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PATH_INFO'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_convert_encoding</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PATH_INFO'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;GBK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
	<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pathinfo_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pathinfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pathinfo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;%25&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pathinfo_array</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$req_uri</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_convert_encoding</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;GBK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$req_uri_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$req_uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>修改后，保存，上传。OK！已经可以支持汉字链接了。</p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/create-multiple-wp-blog-by-one-wp-code/" title="一个WordPress建立多个独立WP博客">一个WordPress建立多个独立WP博客</a><br /><small>共用一个WordPress
可以共用同一个数据库...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/support-the-chinese-tags-and-links-by-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>一个WordPress建立多个独立WP博客</title>
		<link>http://woodfeed.com/create-multiple-wp-blog-by-one-wp-code/</link>
		<comments>http://woodfeed.com/create-multiple-wp-blog-by-one-wp-code/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 02:38:10 +0000</pubDate>
		<dc:creator>vayu</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://woodfeed.com/%e4%b8%80%e4%b8%aawordpress%e5%bb%ba%e7%ab%8b%e5%a4%9a%e4%b8%aa%e7%8b%ac%e7%ab%8bwordpress.html</guid>
		<description><![CDATA[共用一个WordPress
可以共用同一个数据库]]></description>
			<content:encoded><![CDATA[<blockquote><p>共用一个WordPress<br />
可以共用同一个数据库<br />
以建两个为例</p></blockquote>
<p>1.域名要求</p>
<p>域名domain1.com和domain2.com都指向到WordPress的主机空间。</p>
<p>2.修改wp-config.php文件，添加一个条件判断<br />
下面只是修改的数据库部分，其他的不变</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;www.domain1.com&quot;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;domain1.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ** MySQL设置 - 具体信息来自您正在使用的主机 ** //</span>
<span style="color: #009933; font-style: italic;">/** WordPress数据库的名称 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'WoodFeed_db'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** MySQL数据库用户名 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'WoodFeed_user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** MySQL数据库密码 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASSWORD'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blog.woodfeed.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** MySQL主机名 ,如果和空间主机不同，要修改主机名*/</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_HOST'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mysql.woodfeed.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** 创建数据表时默认的文字编码 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_CHARSET'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** 数据库整理类型。如不确定请勿更改 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_COLLATE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**#@+ * 身份密匙设定。 * * 您可以随意写一些字符 * 或者直接访问 {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org Secret-key页面将自动为您生成，任何修改都会导致cookies失效，所以用户必须重新登录} * * @since 2.6.0 */</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SECURE_AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'LOGGED_IN_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'NONCE_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**#@-*/</span> <span style="color: #009933; font-style: italic;">/** * WordPress数据表前缀。 * * 如果您有在同一数据库内安装多个 WordPress 的需求，请为每个 WordPress 设置不同的数据表前缀。 * 前缀名只能为数字、字母加下划线。 */</span>
<span style="color: #000088;">$table_prefix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'wp_'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** * WordPress语言设置。默认为英语。 * * 本项设定能够让 WordPress 显示您需要的语言。wp-content/languages 内应放置同名的 .mo 语言文件。 * 要使用 WordPress 简体中文界面，只需填入 zh_CN。 */</span>
<span style="color: #990000;">define</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WPLANG'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'zh_CN'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;www.domain2.com&quot;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;domain2.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'woodfeed_db'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'woodfeed_user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASSWORD'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'woodfeed.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_HOST'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mysql.woodfeed.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_CHARSET'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_COLLATE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SECURE_AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'LOGGED_IN_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'NONCE_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'替换该字符串'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** 如果要在一个数据库中建立多个WordPress，要修改表头，如下 */</span>
<span style="color: #000088;">$table_prefix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'wb_'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**默认为English，不填为English */</span>
<span style="color: #990000;">define</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WPLANG'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<blockquote><p>ｐｓ：<br />
１.使用同一个数据库要修改 $table_prefix<br />
2.将上面MySQL主机名该为由主机提供的，和主机一样使用 localhost<br />
3.分别使用domain1.com和domain2.com安装WordPress<br />
4.安装成功以后，需要在 设置-&gt;杂项 中设置两个站点所上传文件保存的目录，否则两个站点上传的文件将默认存放在wp-content/uploads中。</p></blockquote>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://woodfeed.com/support-the-chinese-tags-and-links-by-wordpress/" title="让WordPress支持中文tag和链接">让WordPress支持中文tag和链接</a><br /><small>有的人用文章名做固定链接（%postname%），但是汉字标题出来后，地址栏的链接就变为...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://woodfeed.com/create-multiple-wp-blog-by-one-wp-code/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
