ASP网站如何做301重定向

 时间:2026-02-16 00:28:51

1、先上一段我经常使用的asp代码:

<%

Dimdomain301,sn

domain301=Request.ServerVariables("Server_name")

'获取域名'这里的3是指www的长度

ifleft(domain301,3<>"www"then

Response.Status="301MovedPermanently"    if(Request.ServerVariables("Query_String")<>""

)then 

Response.AddHeader"Location","http://www.lichuangcheng.com"&Request.ServerVariables("Path_Info")&"?"&Request.ServerVariables("Query_String")

else

Response.AddHeader"Location","http://www.lichuangcheng.com"&Request.ServerVariables("Path_Info") 

endif

Response.End

end if

%> 

具体的思路就是,判断域名是不是有www,没有www的话跳转到一个添加了www的网址上。

1、另外,ASP网站也可以通过以下两种方式来配置301重定向:

第一种、配置VPS或者独立服务器    

第二种、配置伪静态规则,这个相对会复杂一些,详细的方法以后野狼也会写出来。

  • ASP.NET网站如何配置301重定向
  • 怎么做301重定向?
  • 301重定向设置方法大全
  • 网站301重定向,网站301
  • apache 301重定向
  • 热门搜索
    谚语是什么意思 什么是机器人 梦见吃鱼是什么意思 农历七月十五是什么节 5g手机什么时候出 atm是什么意思 广州有什么大学 海鲜不能和什么一起吃 t字标志是什么车 until是什么意思