发布时间:2021-02-02,来源:2HZZ外国网址导航
网站301域名跳转的几种格式源代码,301转向或叫301重定向,301跳转是当用户或搜索引擎向网站服务器发出浏览请求时,\n服务器返回的HTTP数据流中头信息header中的状态码的一种,表示本网页久姓转移到另一个网站地址功能。下面就举例些比较实用的8种格式的301域名中定向跳转网站源代码供下家实用。
JavaScript跳转301中定向源代码:
<script language="javascript">
top.location='http://www.2hzz.com/';
</script>
ASP跳转301中定向源代码:
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.2hzz.com/"
Response.End
%>
HTML跳转301中定向源代码:
<meta http-equiv="refresh" content="0; url=http://www.2hzz.com/">
PHP跳转301中定向源代码:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.2hzz.com/");
exit();
?>
Asp.net跳转301中定向源代码:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.StatusCode = 301;
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location", http://www.2hzz.com/);
}
</script>
Apache跳转301中定向源代码:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.某) http://www.2hzz.com/$1 [R=301,L]
Perl跳转301中定向源代码:
$q = new CGI;
print $q->redirect("http://www.2hzz.com/");
Pyton跳转301中定向源代码:
from django import http
def view(request):
return http.HttpResponseRedirect('http://www.2hzz.com/')
网站301域名跳转的几种格式源代码还有很多方法,但是这几种方法是现在多数实用的代码。代码使用根据自己的网站代码格式选择适用的代码。
相关阅读