织梦网站去除首页index.html的方法
在seo中站内优化是很重要的一部分,其中首页的的优化尤为重要,今天跟大家分享一下首页URL路径的优化。用dedecms安装程序后,你也许会发现打开首页后其路径是这样的:http://www.123456.com/index.html,这种路径远没有http://www.123456.com/路径好。那么怎么去掉后面的index.html呢?具体方法是将空间根目录下的index.php文件中的<?phpif(!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啦。
不错不错,楼主您辛苦了。。。 想找男朋友行不? 路过,支持一下啦! 不错不错,楼主您辛苦了。。。 不错不错,楼主您辛苦了。。。 帮帮顶顶!!! 这是什么东东啊? 觉得LZ人好好哦~我很认真的看了~觉得真的很有用~谢谢~ 路过,支持一下啦!
页:
[1]
2