如何去掉网站首页及频道地址的扩展名index.html
【小 中 大】【收藏】 作者: 佚名 来源: 互联网络 阅读 次 【加入会员】
大部分情况下,http://www.msgz.org/ 与 http://www.msgz.org/index.asp 的 Google PageRank 是不同的。据说,在google 看来,目录的权重比文件大。默认情况下,动易的标签 {$ShowChannel} 输出时,网站首页、频道首页的地址都是{$InstallDir}index.htm、{$InstallDir}Article/index.asp 的形式,如何才能修改为 {$InstallDir}、{$InstallDir}Article/ 的形式呢?
只需修改 Include/PowerEasy.Common.Front.asp 中的Function GetChannelList(NumNewLine),进而改变标签 {$ShowChannel} 的输出即可。下面以动易开源版SiteWeaver™ CMS 6.5为例进行说明。
第一步,将网站首页地址由 {$InstallDir}index.htm 的形式修改为 {$InstallDir} 的形式。在 Include/PowerEasy.Common.Front.asp 中找到如下代码:
If ChannelID = 0 Then
strChannel = ChannelLink & “<a class=”Channel2” href=”” & strInstallDir & FileName_SiteIndex & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
Else
strChannel = ChannelLink & “<a class=”Channel” href=”” & strInstallDir & FileName_SiteIndex & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
End If
将其修改为:
If ChannelID = 0 Then
strChannel = ChannelLink & “<a class=”Channel2” href=”” & strInstallDir & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
Else
strChannel = ChannelLink & “<a class=”Channel” href=”” & strInstallDir & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
End If
第二步,将频道首页地址由 {$InstallDir}Article/index.htm 的形式修改为 {$InstallDir}Article/ 的形式。在 Include/PowerEasy.Common.Front.asp 中找到如下代码:
If rsChannel(“UseCreateHTML”) > 0 Then
strChannel = strChannel & ” href=”” & ChannelUrl & “/Index” & arrFileExt(rsChannel(“FileExt_Index”)) & “””
Else
strChannel = strChannel & ” href=”” & ChannelUrl & “/Index.asp””
End If
将其修改为
strChannel = strChannel & ” href=”” & ChannelUrl & “/””
修改完成后,保存文件,更新缓存,如果网站首页或某频道首页需要生成html,进行生成后刷新页面即可。另外,注意一下默认文档顺序(例如:网站首页生成html后缀为“.htm”,但默认文档中index.asp i优先于 index.htm,则访问网站目录 {$InstallDir} 时,系统会调用index.asp而非index.htm,然后跳转到index.htm,这种情况下地址栏显示的地址不是目录形式,多了个index.htm)
手机扫码阅读本文