在seo中站内优化是很重要的一部分,其中首页的的优化尤为重要,今天跟大家分享一下首页URL路径的优化。用dedecms
安装程序后,你也许会发现打开首页后其路径是这样的:http://www.123456.com/index.html,这种路径远没有http://www.123456.com/路径好。那么怎么去掉后面的index.html呢?
具体方法是将空间根目录下的index.php文件中的
<?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_onceDEDEINC."/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']);
$pv->SaveToHtml(dirname(__FILE__).’/index.html’);
include(dirname(__FILE__).’/index.html’);
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 `#@__homepageset`");
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$pv->Display();
?>
完后保存就ok啦。