level 5
zoulinss88
楼主
Dede默认生成首页后,首页的链接后面会多出一个index.html。据官方说法这样有利于网站优化。但是这个index.html怎么看都不舒服,而且也不利于seo中主页url的统一。所以出于不让首页权重分散考虑,同时也是美观考虑,dede首页的index.html还是得去掉好。
下面嘉绵之恋就给大家分享一下如何去掉织梦网首页的index.html
方法一:也是最简单行之有效的办法。
找到根目录下的index.php文件,找到如下内容
//自动生成HTML版
if(isset($_GET['upcache']) || !file_exists('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 `#@__homepageset`");
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;
if ($row['showmod'] == 1)
{
$pv->SaveToHtml(dirname(__FILE__).'/index.html');
include(dirname(__FILE__).'/index.html');
exit();
} else {
$pv->Display();
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();
?>
方法二:
使用.htaccess文件目前使用的是这个办法,试验成功。
方法如下:
在根目录的.htaccess里加入以下代码:
DirectoryIndex index.html index.php index.htm
就这么简单。
方法三:
在主机里面设置默认首页顺序:把index.html提到最前面。
因主机不同,设置方法也不同。就不具体细说了。
转载请注明出处为“本文转载于『嘉绵之恋』原地址http://www.zl266.com/post/108.html”
2015年01月05日 15点01分
1
下面嘉绵之恋就给大家分享一下如何去掉织梦网首页的index.html
方法一:也是最简单行之有效的办法。
找到根目录下的index.php文件,找到如下内容
//自动生成HTML版
if(isset($_GET['upcache']) || !file_exists('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 `#@__homepageset`");
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;
if ($row['showmod'] == 1)
{
$pv->SaveToHtml(dirname(__FILE__).'/index.html');
include(dirname(__FILE__).'/index.html');
exit();
} else {
$pv->Display();
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();
?>
方法二:
使用.htaccess文件目前使用的是这个办法,试验成功。
方法如下:
在根目录的.htaccess里加入以下代码:
DirectoryIndex index.html index.php index.htm
就这么简单。
方法三:
在主机里面设置默认首页顺序:把index.html提到最前面。
因主机不同,设置方法也不同。就不具体细说了。
转载请注明出处为“本文转载于『嘉绵之恋』原地址http://www.zl266.com/post/108.html”