栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

如何隐藏dedecms网站首页网址显示的index.html

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何隐藏dedecms网站首页网址显示的index.html

有的Dedecms织梦默认生成首页后,首页的链接后面会多出一个index.html,官方说法这样有利于网站优化。出于不让首页权重分散考虑,同时也是美观考虑,dede首页的index.html还是得去掉好。     下面就给大家分享一下如何去掉织梦首页的index.html     方法一:     使用.htaccess文件目前使用的是这个办法,试验成功。     方法如下:     在根目录的.htaccess里加入以下代码:     DirectoryIndex index.html index.php index.htm     方法二:     在主机里面设置默认首页顺序:把index.html提到最前面。     因主机不同,设置方法也不同,大多数空间都是在空间商会员后台可以改动。例如:万网。     方法三:也是最简单行之有效的办法。     找到根目录下的index.php文件,找到如下内容     //自动生成HTML版     if(isset($_GET['upcache']) || !file_exists('index.html'))     {     require_once (dirname(__FILE__) . "/include/common.inc.php");     require_once DEDEINC."/arc.partview.class.php";     $GLOBALS['_arclistEnv'] = 'index';     $row = $dsql->GetOne("Select * From `dede_homepageset`");     $row['templet'] = MfTemplet($row['templet']);     $pv = new PartView();     $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);     $row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;     if ($row['showmod'] == 1)     {     $pv->SaveToHtml(dirname(__FILE__).'/index.html');     include(dirname(__FILE__).'/index.html');     exit();     } else {     $pv->Display();     exit();     }     }     else     {     header('HTTP/1.1 301 Moved Permanently');     header('Location:index.html');     }     ?>     把上面一大段替换成下面的这段代码     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 `dede_homepageset`");     $row['templet'] = MfTemplet($row['templet']);     $pv = new PartView();     $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);     $pv->Display();     ?>

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/5220.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号