今天小狼的网站莆田妇产科网站上线,我发现首页http://fuke.fj91bbs.com/index.html 会多个index.html我觉得不好看,所以研究了下怎么去掉它。废话不多说,直接操作吧。
方法:把dedecms根目录index.php用dw或者其他编辑器打开,直接把内容更改为
<?php //自动生成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']); $pv->SaveToHtml(dirname(__FILE__).'/index.html'); include(dirname(__FILE__).'/index.html'); exit(); ?> <?php //自动生成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']); $pv->SaveToHtml(dirname(__FILE__).'/index.html'); include(dirname(__FILE__).'/index.html'); exit(); ?>
其实最主要就是把那段301重定向代码删除
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:index.html’);