账号通
    

账号  

密码  

3192

查看

7

回复
主题:科汛完美301跳转 [收藏主题] 转到:  
anflash 当前离线

209

主题

2

广播

36

粉丝
添加关注
级别:二年级

用户积分:1084 分
登录次数:631 次
注册时间:2011/12/22
最后登录:2024/8/3
anflash 发表于:2013/11/21 21:42:16   | 显示全部帖子 查看该作者主题 楼主 
301是优化的必备步骤之一,让不带www的域名跳转到带www的域名上,从而增加带www域名的权重(减少分权)。然而部分空间是不支持301跳转的,为此在科汛CMS程序中开发出ASP版完美301跳转。
只需修改一处asp文件
/Conn.asp


<%
'========301跳转开始========
Dim An_Jump,An_Static
An_Jump=False '是否开启301跳转 开启: True  关闭: False
An_Static=False '是否开启伪静态 开启: True  关闭: False


If Lcase(Left(Request.ServerVariables("Server_name"),3))<>"www" and An_Jump Then

Response.Status="301 Moved Permanently"


Response.AddHeader "Location", GetUrl


Response.End

End If
'Response.Write  GetUrl '测试url
Function GetUrl()

On Error Resume Next


Dim strTemp


If LCase(Request.ServerVariables("HTTPS")) = "off" Then


  strTemp = "http://"


Else


  strTemp = "https://"


End If


If Lcase(Left(Request.ServerVariables("Server_name"),3))<>"www" Then


  strTemp = strTemp&"www."


End If


strTemp = strTemp & Request.ServerVariables("SERVER_NAME")


If Request.ServerVariables("SERVER_PORT") <> 80 Then


strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")


end if


If An_Static Then


  Dim id,page,m,d,n


  id=Request.QueryString("id")


  page=Request.QueryString("page")


  m=Request.QueryString("m")


  d=Request.QueryString("d")


  n=Request.QueryString("n")


  If id<>"" Then


    If page<>"" Then


  strTemp = strTemp & "/list-"&id&"-"&page&".html"


Else


  strTemp = strTemp & "/list-"&id&".html"


End If


  End If


  If m<>"" and d<>"" Then


    strTemp = strTemp & "/thread-"&d&"-"&m&".html"


  End If


  If n<>"" Then


    strTemp = strTemp & "/plus/tags.asp?n="&n


  End If


Else


  strTemp = strTemp & Replace(Request.ServerVariables("URL"),"index.asp","")


  If Trim(Request.QueryString) <> "" Then


    strTemp = strTemp & "?" & Trim(Request.QueryString)


  end if


End If


GetUrl = strTemp

End Function
'========301跳转结束========
%>
<%
'Response.Buffer=True
Dim SqlNowString,DataPart_D,DataPart_Y,DataPart_H,DataPart_S,DataPart_W,DataPart_M,CurrentPage
Dim Conn,DBPath,CollectDBPath,DataServer,DataUser,DataBaseName,DataBasePsw,ConnStr,CollcetConnStr
Const DataBaseType=0                 '系统数据库类型,"1"为MS SQL2000数据库,"0"为MS ACCESS 2000数据库
Const MsxmlVersion=".3.0"                '系统采用XML版本设置


Const EnableSiteManageCode = False         '是否启用后台管理认证密码 是: True  否: False
Const SiteManageCode = "8888"      '后台管理认证密码,请修改,这样即使有人知道了您的后台用户名和密码也不能登录后台
Const IsBusiness=False              '是否正式官方授权版本,免费版本请填写False,正式版填写True




备注:红色为添加部分
注释:1、默认是关闭301跳转
         2、默认跳转后没有开启伪静态,如果后台开启了伪静态(不带问号的)此处也要开启,不然跳转后的连接是asp
 
个人QQ:845977434
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
<上一主题 | 下一主题 >
Powered By KesionCMS Version X1
厦门科汛软件有限公司 © 2006-2016 页面执行0.08594秒 powered by KesionCMS 9.0