ASP网站如何做301重定向
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。