DEDECMS织梦CMS建站程序用户会发现,输入地址后,而打开的实际地址后面有个index.html,下面飞花如梦就和大家一起分享下这个问题的两种解决方法:
1、把网站默认首页index.html放到index.php前面,这样它自动读到index.html就不会跳转了
2、把DEDECMS的index.php更改为
<?php //自动生成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"]); $pv->SaveToHtml(dirname(__FILE__)."/index.html"); include(dirname(__FILE__)."/index.html"); exit(); ?>
<?php
//自动生成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"]);
$pv->SaveToHtml(dirname(__FILE__)."/index.html");
include(dirname(__FILE__)."/index.html");
exit();
?>
其实主要就是把那段301定向代码删除
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:index.html’);
以上两种方法绝对能解决dedecms首页地址不带index.html。