原文来自:https://www.zixuephp.com
怎么去掉dede织梦首页后面的index.html
怎么去掉dede织梦首页后面的index.html?大家知道dedecms系统按照默认的设置安装后,访问首页时候,域名后面总跟随着一个/index.html的后缀,看起来域名变得很长了,另一个也不利于优化权重会分散.
当然有的空间可能默认显示的就是没带index.html,那么就不用考虑这个问题了.
有两种方法可以实现:
第一种:就是在你的空间控制面板中,将index.html默认首页的优先级设为最高,一般的空间都会提供这种功能,这也是最好的,如果万一,不能怎么办呢?别慌有下面的一种方法即可.
第二种:我们找到dede根目录下的index.php文件:代码如下:
在www/ 跟目录下有个自带的index.php文件,原代码:
- <?php
 - //自动生成HTML版
 - if(isset($_GET['upcache']))
 - {
 - require_once(dirname(__FILE__)."/include/common.inc.php");
 - require_onceDEDEINC."/arc.partview.class.php";
 - $GLOBALS['_arclistEnv']='index';
 - $row=$dsql->GetOne("Select*From`dede_homepageset`");
 - $row['templet']=MfTemplet($row['templet']);
 - $pv=newPartView();
 - $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row['templet']);
 - $pv->SaveToHtml(dirname(__FILE__).'/index.html');
 - include(dirname(__FILE__).'/index.html');
 - exit();
 - }
 - else
 - {
 - header('HTTP/1.1301MovedPermanently');
 - header('Location:index.html');
 - }
 - ?>
 
上面的代码替换为:
- require_once(dirname(__FILE__)."/include/common.inc.php");
 - require_onceDEDEINC."/arc.partview.class.php";
 - $GLOBALS['_arclistEnv']='index';
 - $row=$dsql->GetOne("Select*From`dede_homepageset`");
 - $row['templet']=MfTemplet($row['templet']);
 - $pv=newPartView();
 - $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row['templet']);
 - $pv->Display();
 
然后就可以了,试试吧.
