織夢(mèng)cms做301跳轉(zhuǎn)的示例:
1.將網(wǎng)站根目錄下“index.php”原文件換成以下內(nèi)容:
$HOST=$_SERVER['HTTP_HOST'];
if ($HOST==”yourweb.com” || $HOST==”piminjie520.082.cccc.org”){
Header(“HTTP/1.1 301 Moved Permanently”);
Header(“Location:http://www.yourweb.com”);
exit();
}
if(!file_exists(dirname(__FILE__).’/data/common.inc.php’))
{
header(‘Location:install/index.php’);
exit();
}
//自動(dòng)生成HTML版
require_once (dirname(__FILE__) . “/include/common.inc.php”);
require_once DEDEINC.”/arc.partview.class.php”;
$GLOBALS['_arclistEnv'] = ‘index’;
$row = $dsql->GetOne(“Select * From`dede_homepageset`”);
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . “/” . $row['templet']);
$pv->Display();
?>
2.保存“index.php”文件的修改并上傳覆蓋。
3.進(jìn)入空間控制面版,把默認(rèn)首頁(yè)更改成“index.php”。
4.更新網(wǎng)站即可看到301重定向的效果。