纠结妹 发表于 2013-5-10 11:31:02

织梦网站去除首页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啦。


龙门飞甲 发表于 2013-8-12 13:46:46

不错不错,楼主您辛苦了。。。

赵奕欢 发表于 2013-8-12 13:47:08

想找男朋友行不?

净坛使者 发表于 2013-8-12 16:00:35

路过,支持一下啦!

荡然“无”存 发表于 2013-8-12 16:00:41

不错不错,楼主您辛苦了。。。

电脑小白 发表于 2013-8-12 16:00:47

不错不错,楼主您辛苦了。。。

中国人 发表于 2013-8-12 16:00:53

帮帮顶顶!!!

ruiqi6330 发表于 2013-8-12 16:01:03

这是什么东东啊?

荡然“无”存 发表于 2013-8-12 16:01:09

觉得LZ人好好哦~我很认真的看了~觉得真的很有用~谢谢~

龙门飞甲 发表于 2013-8-12 16:01:25

路过,支持一下啦!
页: [1] 2
查看完整版本: 织梦网站去除首页index.html的方法