首页 > 开发 > PHP > 正文

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

2024-05-04 21:58:23
字体:
来源:转载
供稿:网友

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

1、asp下的301重定向代码

  1. <%@ language=vbscript %>  
  2. <%  
  3. response.status=”301 moved permanently”  
  4. response.addheader “location”, “106/”  
  5. %> 

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

  1. <script runat=”server”>  
  2. private void page_load(object sender, system.eventargs e)  
  3. {  
  4. response.status = “301 moved permanently”;  
  5. response.addheader(”location”,” 106/“);  
  6. }  
  7. </script>  

3、php下的301重定向代码

  1. header(”http/1.1 301 moved permanently”);  
  2. header(”location: 106/”);  
  3. exit();  

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表