<?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.chenxi.info/tag/301/feed" rel="self" type="application/rss+xml" />
	<link>http://www.chenxi.info</link>
	<description>互联网和IT技术文章</description>
	<lastBuildDate>Thu, 02 Sep 2010 03:51:58 +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>利用javascript进行301重定向</title>
		<link>http://www.chenxi.info/javascript-301-redirect.html</link>
		<comments>http://www.chenxi.info/javascript-301-redirect.html#comments</comments>
		<pubDate>Fri, 05 Feb 2010 02:39:21 +0000</pubDate>
		<dc:creator>chenxi.info</dc:creator>
				<category><![CDATA[网站相关]]></category>
		<category><![CDATA[301]]></category>

		<guid isPermaLink="false">http://www.chenxi.info/?p=373</guid>
		<description><![CDATA[鉴于目前国内网络环境形势严峻，一些需要更换域名的朋友可以使用301重定向不影响以前域名的访问和搜索引擎的收录。]]></description>
			<content:encoded><![CDATA[<p>鉴于目前国内网络环境形势严峻，一些需要更换域名的朋友可以使用301重定向不影响以前域名的访问和搜索引擎的收录。</p>
<p>301重定向（也叫301转向，301跳转）对网站优化所起的作用是不可忽视的，尤其是针对SE（搜索引擎）处理网站页面权重的时候，更加显得重要。网站换了新域名，默认首页需要跳转等，从SEO角度来说，我们都建议使用301重定向，而不是JS跳转或META REFRESH或302转向，这些很容易引来SE的惩罚。<span id="more-373"></span></p>
<p><strong>什么是301重定向呢？</strong></p>
<p>301重定向是当用户或搜索引擎向网站服务器发出浏览请求时，服务器返回的HTTP数据流中头信息 (header)中的状态码的一种，表示本网页永久性转移到另一个地址。其它常见的状态码还包括，200表示一切正常，404网页找不到，302暂时转向，等等。</p>
<p><strong>为什么要用301转向？</strong></p>
<p>网址转向方法主要包括：301转向，302转向，JavaScript转向，PHP/ASP/CGI转向，META REFRESH网页META刷新等。302转向可能会有URL规范化问题。其它方法都是常用的作弊手法，当然不是说不可以正当地用，方法本身没有错，但被作弊者用多了，搜索引擎对这些可疑的转向都很敏感。何必冒险呢。</p>
<p>javascript的301重定向代码</p>
<p><code>&lt;script language=javascript&gt;<br />
if (document.domain =='yourolddomain') <br />
    this.location = "http://yourdomain" + this.location.pathname + this.location.search;<br />
&lt;/script&gt;<br />
</code></p>
<p>ASP下的301重定向</p>
<p><code>&lt;%@ Language=VBScript %&gt;</p>
<p>&lt;%</p>
<p>Response.Status="301 Moved Permanently"</p>
<p>Response.AddHeader "Location","http://yourdomain"</p>
<p>%&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenxi.info/javascript-301-redirect.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
