实用的网站自动跳转代码

  • 内容
  • 相关

1.HTML方式(可隐藏跳转后网址)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>黑蜘蛛博客</title>
<frameset framespacing="0" border="0" rows="0" frameborder="0">
<frame name="main" src="http://4dn.net" scrolling="auto" noresize></frameset>
</head>
<body></body>
</html>

2.HTML

<meta http-equiv="refresh" content="0; url=http://4dn.net">

3.PHP

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://4dn.net");
exit();
?>

4.JavaScript

<script language="javascript">
top.location='http://4dn.net';
</script>

5.Apache(301)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://4dn.net$1 [R=301,L]

6.ASP

<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://4dn.net"
Response.End
%>

7.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://4dn.net);
}
</script>

8.Perl

$q = new CGI;
print $q->redirect("http://4dn.net");

9.Pyton

from django import http
def view(request):
return http.HttpResponseRedirect('http://4dn.net')
黑蜘蛛

本文标签:

版权声明:若无特殊注明,本文皆为《ღ軍尐ღ》原创,转载请保留文章出处。

字数统计:本文共有 《1252》 个。

本文链接:实用的网站自动跳转代码 - https://www.4dn.net/jsxx/128.html