POST TIME:2017-12-02 22:09
DEDECMS模板默認的首頁生成后,鏈接后面會多出一個index.html。官方那邊的說法是有利于網站優化。
但并非每個人都喜歡首頁鏈接多出一個index.html。想去掉,其實并不難。這里讓dedecms模板中心來教你們如何去掉dedeCMS首頁鏈接上的index.html。
有兩種方法:
第一:可以聯系你的空間商把index.html 設置為默認文檔即可
第二:改動根目錄下的index.php文件。
原代碼
<?php
if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
{
header('Location:install/index.php');
exit();
}
//自動生成HTML版
if(isset($_GET['upcache']))
{
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->SaveToHtml(dirname(__FILE__).'/index.html');
include(dirname(__FILE__).'/index.html');
exit();
}
else
{
header('HTTP/1.1 301 Moved Permanently');
header('Location:index.html');
}
?>
替換為
<?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 `dede_homepageset`");
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$pv->Display();
?>
這樣就可以完全去掉DEDECMS模板建站首頁顯示index.html的煩惱!