域名实现301跳转的方法:通过程序语言在对应的配置文件添加代码,例如:ASP的301跳转代码: <%@ Language="VBScript" %><%Response.S
域名实现301跳转的方法:
通过程序语言在对应的配置文件添加代码,例如:
ASP的301跳转代码:
<%@ Language="VBScript" %><%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "Http://www.itdcw.com"
%>
PHP的301跳转代码:
$the_host = $_SERVER['HTTP_HOST']; //获取主域名$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; //获取后缀
if($the_host != 'nanjingseo.org')
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://nanjingseo.org'.$request_uri);
}
asp.net的301跳转代码:
<script runat="server">private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.itdcw.com");
}
</script>
CGI Perl的301跳转代码:
$q = new CGI;print $q->redirect("http://www.itdcw.com");
jsP的301跳转代码:
<%response.setStatus(301);
response.setHeader( "Location", "http://www.itdcw.com" );
response.setHeader( "Connection", "close" );
%>
--结束END--
本文标题: 域名如何实现301跳转
本文链接: https://lsjlt.com/news/114759.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0