DEDECMS織夢CMS建站程序用戶會發(fā)現(xiàn),輸入地址后,而打開的實際地址后面有個index.html,下面飛花如夢就和大家一起分享下這個問題的兩種解決方法:
1、把網(wǎng)站默認(rèn)首頁index.html放到index.php前面,這樣它自動讀到index.html就不會跳轉(zhuǎn)了
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。
更多信息請查看IT技術(shù)專欄