织梦网站为静态生成类的cms,所以根目录下有一个index.html静态文件,有不奇怪,但显示出来就不对了,一来有损颜值,二来和利SEO,那么我们就来看看如何才能不显示这个小尾巴.
一:在服务器上把首页默认文件index.php 调整到 index.html前边
二:在模版上把涉及到主页目录的链接都用 根目录标签代替,切忌出现index.html
三 :修改index.php为:
/**
* @version $Id: index.php 1 9:23 2010-11-11 tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
*/
if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
{
header('Location:install/index.php');
exit();
}
//自动生成HTML版
if(isset($_GET['upcache']) || !file_exists('index.html'))
{
require_once (dirname(__FILE__) . "/include/common.inc.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');
}
如果还搞不定,欢迎进群讨论
领取专属 10元无门槛券
私享最新 技术干货