去掉织梦DedeCMS首页链接显示index.html

使用织梦DedeCMS建站的时候,网站首页界面显示没有什么问题,但是URL(浏览器地址栏)中却出现了/index.html的后缀。

对于SEO优化会分散网站首页权重,就算不去考虑搜索引擎优化,看着也感觉不是很爽,那么,怎么去掉这个DedeCMS烦人的尾巴呢?

  1. 一般情况下,显示/index.html这个后缀,都是网站服务器或者虚拟主机默认主页设置的顺序问题,只需要将index.html默认首页的优先级设为最高就可以解决了。如果使用虚拟主机搭建的DedeCMS网站,主机控制面板中都会有这一项。
  2. 对于Web服务器为Apache的虚拟主机来说,只需要在.htaccess文件中增加如下的代码即可:DirectoryIndex index.html index.htm index.php
  3. 如果以上的方法都无法去掉织梦DedeCMS首页链接默认显示的index.html,并且确认默认首页中index.html的优先级已经是最高,那么可以使用如下的方法,找到织梦DedeCMS根目录下的index.php文件,使用如下的代码代替:
<?php
    if(!file_exists(dirname(__FILE__).'/data/common.inc.php')){
        header ('Location:install/index.php');
        exit ();
    }
    require_once (dirname(__FILE__) . "/include/common.inc.php");
    require_once DEDEINC."/arc.partview.class.php";
    $GLOBALS['_arclistEnv'] = 'index';$row = $dsql->GetOne("Select * From `#@__homepageset`");
    $row['templet'] = MfTemplet ($row['templet']);
    $pv = new PartView ();
    $pv -> SetTemplet ($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
    $pv -> Display ();
?>