首页  »  站长资讯  »  网站优化

怎么去掉dedecms织梦首页后面的index.html

2022/11/23 08:48     创新屋收录网     已浏览315次


怎么去掉dedecms织梦首页后面的index.html?大家知道dedecms系统按照默认的设置安装后,访问首页时候,域名后面总跟随着一个/index.html的后缀,看起来域名变得很长了,另一个也不利于优化,首页权重会分散。



当然,有的空间可能默认显示的就是没带index.html,那么就不用考虑这个问题了。



今天说下两种方法可以实现:





第一种: 虚拟主机的话,就是在你的空间控制面板中,将index.html默认首页的优先级设为最高。一般的空间都会提供这种功能。还有以IIS6为例,在IIS里右键属性-文档,添加index.html,移动到最上面。如图:





 



第二种:我们找到dede根目录下的index.php文件:



复制以下代码,然后替换index.php里的代码:













1

"margin: 0px; padding: 0px; outline: none; list-style-type: none; border: none; font-size: 14px; color: rgb(110, 110, 110); font-family: Verdana, 'Arial Narrow', 宋体, 'Microsoft Yahei', 微软雅黑, 'Helvetica Neue', Helvetica, Arial, sans-serif, Simsun, 'Segoe UI'; line-height: 20px;">"margin: 0px; padding: 0px; outline: none; list-style-type: none; border: none;">require_once (dirname(__FILE__) . "/include/common.inc.php");











2

require_once DEDEINC."/arc.partview.class.php";











3

$GLOBALS['_arclistEnv'] = 'index';











4

$row = $dsql->GetOne("Select * From `dede_homepageset`");











5

$row['templet'] = MfTemplet($row['templet']);











6

$pv = new PartView();











7

$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);











8

$pv->Display();











9

?>





但是为了保险起见,两种方法都同时修改。



以上步骤都OK之后,更新首页,看看是不是去掉index.html了!