当前位置:首页 > 网站运营 > 建站运营 > > 不同环境下网站进行301重定向的代码集锦

不同环境下网站进行301重定向的代码集锦

点击次数:32 次 发布日期:2008-12-26 09:50:16 作者:源代码网
源代码网推荐

源代码网整理以下301重定向,也称为301转向。它的功能就是告诉搜索引擎,你的网址永久的变换了,从而将原网址的权重全部定向到新的网址上面,相信很多人都会用到301重定向的。

源代码网整理以下1、ASP下的301转向代码

源代码网整理以下

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://chinaz.com/”
%>

源代码网整理以下3、ASP.Net下的301转向代码

源代码网整理以下

<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://chinaz.com/“);
}
</script>

源代码网整理以下4、PHP下的301转向代码

源代码网整理以下

源代码网整理以下header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://chinaz.com/”);
exit();

源代码网整理以下5、CGI Perl下的301转向代码

源代码网整理以下$q = new CGI;
print $q->redirect(”http://chinaz.com/”);

源代码网整理以下 源代码网供稿.

网友评论 (0)
会员中心
网站运营
本站推荐
网站运营之精华