<?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; 多域名</title>
	<atom:link href="http://ale.net.cn/blog/tag/%e5%a4%9a%e5%9f%9f%e5%90%8d/feed/" rel="self" type="application/rss+xml" />
	<link>http://ale.net.cn/blog</link>
	<description>没有句号的梦想</description>
	<lastBuildDate>Wed, 22 Dec 2010 14:56:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>为wordpress绑定多个域名</title>
		<link>http://ale.net.cn/blog/2009/08/%e4%b8%bawordpress%e7%bb%91%e5%ae%9a%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d/</link>
		<comments>http://ale.net.cn/blog/2009/08/%e4%b8%bawordpress%e7%bb%91%e5%ae%9a%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 15:31:10 +0000</pubDate>
		<dc:creator>ale</dc:creator>
				<category><![CDATA[程序]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[多域名]]></category>

		<guid isPermaLink="false">http://ale.net.cn/blog/?p=89</guid>
		<description><![CDATA[按照默认设置，wordpress只能绑定一个域名，与域名相关的两个option选项是siteurl和home，这些域名数据存在数据库里。
但是，自定义常量的优先级要高于数据库。所以，对于有多个镜像的blog，可以通过修改wp-config.php为Wordpress绑定多个域名。
将以下代码插入到wp-config.php中，就会根据域名设置wordpress的目录和显示目录。
if ($_SERVER['HTTP_HOST']==&#8221;www.w2.com&#8221;):
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w2.com&#8221;);
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w2.com&#8221;);
elseif ($_SERVER['HTTP_HOST']==&#8221;www.w3.com&#8221;):
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w3.com&#8221;);
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w3.com&#8221;);
else :
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w4.com&#8221;);
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w4.com&#8221;);
endif;
]]></description>
			<content:encoded><![CDATA[<p>按照默认设置，wordpress只能绑定一个域名，与域名相关的两个option选项是siteurl和home，这些域名数据存在数据库里。</p>
<p>但是，<strong><span style="color: #ff0000;">自定义常量的优先级要高于数据库</span></strong>。所以，对于有多个镜像的blog，可以通过修改wp-config.php为Wordpress绑定多个域名。</p>
<p>将以下代码插入到wp-config.php中，就会根据域名设置wordpress的目录和显示目录。</p>
<p>if ($_SERVER['HTTP_HOST']==&#8221;www.w2.com&#8221;):<br />
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w2.com&#8221;);<br />
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w2.com&#8221;);<br />
elseif ($_SERVER['HTTP_HOST']==&#8221;www.w3.com&#8221;):<br />
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w3.com&#8221;);<br />
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w3.com&#8221;);<br />
else :<br />
 define(&#8221;WP_SITEURL&#8221;, &#8220;http://www.w4.com&#8221;);<br />
 define(&#8221;WP_HOME&#8221;, &#8220;http://www.w4.com&#8221;);<br />
endif;</p>
]]></content:encoded>
			<wfw:commentRss>http://ale.net.cn/blog/2009/08/%e4%b8%bawordpress%e7%bb%91%e5%ae%9a%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

