<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post//</link>
<title><![CDATA[ASP中的301跳转和302跳转]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[服务器类]]></category>
<pubDate>Wed, 29 Apr 2009 07:52:52 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//</guid> 
<description>
<![CDATA[ 
	ASP 中，我们习惯使用 Response.Redirdect 来实现页面的跳转，但是这种跳转方式的状态是 302 的，属于临时跳转，对于搜索引擎来说，是一种不友好的重定向方式。<br/><br/>ASP 3.0 中，有了另一种方式，即 Response.Transfer 。关于这个，可以查询相关的信息。<br/><br/>我们这里要讨论的是 301 跳转，例如下面的代码：<br/><br/>&lt;%@ Language=&quot;VBScript&quot; %&gt;<br/>&lt;%<br/>Response.Status = &quot;301 Moved Permanently&quot;<br/>Response.AddHeader &quot;Location&quot;, &quot;http://www.purewhite.cn&quot;<br/>%&gt;<br/>这种方式，对于搜索引擎来说，是永久性的，跳转后的页面的内容可以被采用。由此，想到一些人问到的，如何实现同一个空间绑定多个域名。其实，只要针对输入的域名进行识别，然后结合 301 跳转来选择目标就能很好实现。假设有域名 www.yunna.net 和 www.purewhite.cn ，分别针对同一个空间中的 yunna_net 和 purewhite_cn 两个目录，那么怎么通过两个域名来自动确定访问哪个目录呢？请看下面的代码：<br/><br/>&lt;%<br/>Dim strHost = LCase(Request.ServerVariables(&quot;HTTP_HOST&quot;))<br/>Response.Status = &quot;301 Moved Permanently&quot;<br/>Select Case strHost<br/>&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;www.xxxx.net&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.AddHeader &quot;Location&quot;, <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;http://www.xxxx.net/xxxx_net/&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;www.xxxx.cn&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.AddHeader &quot;Location&quot;, <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;http://www.xxxx.cn/xxxx_cn/&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Case Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.AddHeader &quot;Location&quot;, <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;http://www.xxxx.cn/xxxx_cn/&quot;<br/>End Select<br/>%&gt; <br/>Tags - <a href="http://www.zhanghaijun.com/tags/asp/" rel="tag">asp</a> , <a href="http://www.zhanghaijun.com/tags/301/" rel="tag">301</a> , <a href="http://www.zhanghaijun.com/tags/302/" rel="tag">302</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post//#blogcomment</link>
<title><![CDATA[[评论] ASP中的301跳转和302跳转]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>