怎麼去掉織夢網站裡面的index.html

來源:互聯網
上載者:User

仲介交易 HTTP://www.aliyun.com/zixun/aggregation/6858.html">SEO診斷 淘寶客 雲主機 技術大廳

最近有好些站長朋友反映他們用織夢系統搭建的網站打開網站功能變數名稱老是跳轉到index.html問我有沒有辦法去掉。

要解決這個問題首先我得搞清楚這個問題是怎麼引起的,其實這個問題的出現是因為根目錄下面的index.php,我們截取index.php從第14行到38行代碼

if(isset($_GET['upcache']) || !file_exists(‘index.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']);

$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;

if ($row['showmod'] == 1)

{

$pv->SaveToHtml(dirname(__FILE__)。 ‘/index.html’);

include(dirname(__FILE__)。 ‘/index.html’);

exit();

} else {

$pv->Display();

exit();

}

}

else

{

header(‘HTTP/1.1 301 Moved Permanently’);

header(‘Location:index.html’);

}

這裡有一個判斷,網站在不加upcache參數的情況下(www.dedevvip.com/index.php?upcache=1)和網站根目錄下不存在index.html那麼他就直接跳轉到index.html

這樣知道問題根源了,那接下來我就給出解決辦法,我們分兩種情況

一、直接動態流覽

網站動態訪問的情況下,程式會刪除根目錄下面的Index.html ,那麼他會執行include(dirname(__FILE__)。 ‘/index.html’);這段代碼,把首頁引用而非跳轉。

  

二、靜態訪問

關於這種情況,我們這裡分兩種。

1、IIS

打開IIS點擊文檔,裡面將index.html置於index.php上面,這有什麼作用呢?其實這樣設置就是在網站同時有index.php和index.html的情況下,先訪問index,html這樣就不會出現跳轉的情況

  

2、Apache

apache裡面DirectoryIndex來控制檔檢索優先順序的

DirectoryIndex index.html index.php index.htm

和iis一樣,我們將index.html往前放

轉載請注明來源:HTTP://www.dedevvip.com/question/11.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.