实用的网站自动跳转代码

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="https://www.osuu.net" scrolling="auto" noresize></frameset>
</head>
<body></body>
</html>

2.HTML

<meta http-equiv="refresh" content="0; url=https://www.osuu.net">

3.PHP

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.osuu.net");
exit();
?>

4.JavaScript

<script language="javascript">
top.location='https://www.osuu.net';
</script>

5.Apache(301)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) https://www.osuu.net$1 [R=301,L]

6.ASP

<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","https://www.osuu.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", https://www.osuu.net);
}
</script>

8.Perl

$q = new CGI;
print $q->redirect("https://www.osuu.net");

9.Pyton

from django import http
def view(request):
return http.HttpResponseRedirect('https://www.osuu.net')
© 版权声明
THE END
喜欢就支持一下吧
点赞2 分享
共1条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像一位WordPress评论者0