"景先生毕设|www.jxszl.com

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

2022-10-29 16:23编辑: www.jxszl.com景先生毕设
有的Dedecms织梦默认生成首页后,首页的链接后面会多出I.个index.html,官方说法这样有利于网站优化.出于不让首页权重分散考虑,同时也是美观考虑,dede首页的index.html还是得去掉好.

下面就给大家分享I.下如何去掉织梦首页的index.html

 更多精彩就在: 51免费论文网|www.jxszl.com 
r/>方法I.:

使用.htaccess文件目前使用的是这个办法,试验成功.

方法如下:

在根目录的.htaccess里加入以下代码:

DirectoryIndexindex.htmlindex.phpindex.htm

方法II:

在主机里面设置默认首页顺序:把index.html提到最前面.

因主机不同,设置方法也不同,大多数空间都是在空间商会员后台可以改动.例如:万网.

方法III:也是最简单行之有效的办法.

找到根目录下的index.php文件,找到如下内容

//自动生成HTML版

if(isset($_GET[upcache])||!file_exists(index.html))

{

require_once(dirname(_FILE_)."/include/common.inc.php");

require_onceDEDEINC."/arc.partview.class.php";

$GLOBALS[_arclistEnv]=index;

$row=$dsql->GetOne("Select*From`dede_homepageset`");

$row[templet]=MfTemplet($row[templet]);

$pv=newPartView();

$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row[templet]);

$row[showmod]=isset($row[showmod])?$row[showmod]:0;

if($row[showmod]==I.)

{

$pv->SaveToHtml(dirname(_FILE_)./index.html);

include(dirname(_FILE_)./index.html);

exit();

}else{

$pv->Display();

exit();

}

}

else

{

header(HTTP/I..I.III0I.MovedPermanently);

header(Location:index.html);

}

?>

把上面I.大段替换成下面的这段代码

if(!file_exists(dirname(_FILE_)./data/common.inc.php))

{

header(Location:install/index.php);

exit();

}

require_once(dirname(_FILE_)."/include/common.inc.php");

require_onceDEDEINC."/arc.partview.class.php";

$GLOBALS[_arclistEnv]=index;

$row=$dsql->GetOne("Select*From`dede_homepageset`");

$row[templet]=MfTemplet($row[templet]);

$pv=newPartView();

$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row[templet]);

$pv->Display();

?>


原文链接:http://www.jxszl.com/biancheng/dedecms/74677.html