织梦访问首页时地址后的index.html该如何去掉

  • A+
所属分类:仿站

织梦访问首页时地址后的index.html该如何去掉

很多朋友在使用织梦建站或者仿站时都会发现,在访问首页时后面都会添加上index.html 

现在我就把这解决办法分享出来,大家可以试一试,看有没有用 
 
在www/ 跟目录下有个自带的index.php文件 
原代码 
 
//自动生成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'); 
} 
?> 
把上面的代码替换为 
 
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(); 
?> 
然后就可以了。 
 
 
 

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: