ASP网站如何做301重定向

2025-04-17 05:27:13

1、先上一段我经常使用的asp代码:<%Dimdomain301,sndomain301=Request.ServerVari锾攒揉敫ables("Server_name")'获取域名'这里的3是指www的长度ifleft(domain301,3<>"www"thenResponse.Status="301MovedPermanently"    if(Request.ServerVariables("Query_String")<>"")thenResponse.AddHeader"Location","http://www.lichuangcheng.com"&Request.ServerVariables("Path_Info")&"?"&Request.ServerVariables("Query_String")elseResponse.AddHeader"Location","http://www.lichuangcheng.com"&Request.ServerVariables("Path_Info")endifResponse.Endend if%> 具体的思路就是,判断域名是不是有www,没有www的话跳转到一个添加了www的网址上。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
  • 阅读量:91
  • 阅读量:85
  • 阅读量:42
  • 阅读量:36
  • 阅读量:96
  • 猜你喜欢