<?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; 301</title>
	<atom:link href="http://www.zui88.com/view-tag/301/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zui88.com/blog</link>
	<description>中山php&#124;最优网络</description>
	<lastBuildDate>Mon, 13 May 2013 04:56:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>二级目录下，htaccess做301重定向，把ip地址转向域名</title>
		<link>http://www.zui88.com/blog/view-211.html</link>
		<comments>http://www.zui88.com/blog/view-211.html#comments</comments>
		<pubDate>Fri, 26 Aug 2011 07:14:35 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[后端程序]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://www.zui88.com/blog/?p=211</guid>
		<description><![CDATA[因为网站是放在独立IP的主机上，百度和谷歌直接通过ip地址收录了网站许多页面，包括二级目录下的页面，因为子目录下也存在htaccess文件，有自己的规则，所以根目录的301跳转规则对子目录无效，需要在子目录下再做301重定向。 发现子目录与根目录不同的地方是访问地址后面有没有加斜杠所请求的地址有一点点不同，下面是规则： RewriteBase /news RewriteCond %{HTTP_HOST} ^zui88.com [NC] RewriteRule com(.*)$ http://www.zui88.com$1 [L,R=301] #不加斜杠请求的地址是/wwwroot/zui88.com/news/ RewriteCond %{HTTP_HOST} ^zui88.com [NC] RewriteRule (.*)$ http://www.zui88.com/news/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC] RewriteRule com(.*)$ http://www.zui88.com$1 [L,R=301] RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC] RewriteRule (.*)$ http://www.zui88.com/news/$1 [L,R=301]]]></description>
			<content:encoded><![CDATA[<p>因为网站是放在独立IP的主机上，百度和谷歌直接通过ip地址收录了网站许多页面，包括二级目录下的页面，因为子目录下也存在htaccess文件，有自己的规则，所以根目录的301跳转规则对子目录无效，需要在子目录下再做301重定向。</p>
<p>发现子目录与根目录不同的地方是访问地址后面有没有加斜杠所请求的地址有一点点不同，下面是规则：</p>
<p>RewriteBase /news<br />
RewriteCond %{HTTP_HOST} ^zui88.com [NC]<br />
RewriteRule com(.*)$ http://www.zui88.com$1 [L,R=301]<br />
#不加斜杠请求的地址是/wwwroot/zui88.com/news/<br />
RewriteCond %{HTTP_HOST} ^zui88.com [NC]<br />
RewriteRule (.*)$ http://www.zui88.com/news/$1 [L,R=301]</p>
<p>RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]<br />
RewriteRule com(.*)$ http://www.zui88.com$1 [L,R=301]</p>
<p>RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]<br />
RewriteRule (.*)$ http://www.zui88.com/news/$1 [L,R=301]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-211.html/feed</wfw:commentRss>
		<slash:comments>221</slash:comments>
		</item>
	</channel>
</rss>
