您的位置首页百科问答

如何将DEDE织梦网站首页的index.html去掉

如何将DEDE织梦网站首页的index.html去掉

的有关信息介绍如下:

如何将DEDE织梦网站首页的index.html去掉

Dede默认生成首页后,首页的链接后面会多出一个index.html。据官方说法这样有利于网站优化。 

但是这个index.html怎么看都不舒服,而且也不利于seo中主页url的统一。因为我的网站的url用.htaccess转向统一都是www,而带.com结尾的。  

所以出于不让首页权重分散考虑,同时也是美观考虑,dede首页的index.html还是得去掉好。 

1、把网站默认首页index.html放到index.php前面,这样它自动读到index.html就不会跳转了

按官方给的更新说明 替换index.php的内容 生成动态,如果首页不需要生成HTML的, 把index.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');

}

?>

替换为

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();

?>

到FTP中下载index.php,用Dreamweaver打开,将上述代码进行替换即可。

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

方法如下:  在根目录的.htaccess里加入以下代码:  DirectoryIndex index.html index.php index.htm就这么简单。 

在主机里面设置默认首页顺序:把index.html提到最前面。  因主机不同,设置方法也不同。就不具体细说了。 

一般都不去这些的