Home >php教程 >php手册 >asp/asp.net/php实现301重定向代码

asp/asp.net/php实现301重定向代码

WBOY
WBOYOriginal
2016-05-25 16:43:012069browse

asp/asp.net/php实现301重定向代码,一般我们做301是全用iis,apache来实现,在没有操作服务器的时我们再用脚本来实现,代码如下.

1、asp下的301重定向代码

<%@ language=vbscript %>  
<%  
response.status="301 moved permanently"  
response.addheader "location", "106/"  
%>

2、asp.net下的301重定向代码

<script runat="server">  
private void page_load(object sender, system.eventargs e)  
{  
    response.status = "301 moved permanently";  
    response.addheader("location"," 106/");  
}  
</script>

 

3、php下的301重定向代码

header("http/1.1 301 moved permanently");  
header("location: 106/");  
exit();


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn