有的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(); ?> |
新聞熱點
疑難解答