dedecms強制去掉首頁index.html的方法

來源:互聯網
上載者:User

標籤:color   自己   index   通過   head   sts   bsp   php檔案   簡單   

dedecms預設是通過後台產生index.html,但是往往一些站長朋友不喜歡index.html,而是喜歡直接使用index.php,預設首頁對seo沒有影響,所以去不去掉index.html全看自己

dedecms去掉首頁index.html的方法如下。 

1.按官方給的更新說明 替換index.php的內容 產生動態, 
如果首頁不需要產生HTML的, 把index.php換成下面代碼 

<?phpif(!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 `dede_homepageset`"); $row[‘templet‘] = MfTemplet($row[‘templet‘]); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row[‘templet‘]); $pv->Display();  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 `dede_homepageset`"); $row[‘templet‘] = MfTemplet($row[‘templet‘]); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row[‘templet‘]); $pv->Display();  ?>

 

當然如果要產生html就不行了。 

2.直接刪除CMS根目下的index.php檔案, 
這個辦法看似最簡單,但是我自己試過後卻不成功。而且刪除後也沒辦法使用動態瀏覽了。 

3.使用.htaccess檔案 
目前使用的是這個辦法,實驗成功。 
方法如下: 
在根目錄的.htaccess裡加入以下代碼: 
DirectoryIndex index.html index.php index.htm 
就這麼簡單。 

4.在主機裡面設定預設首頁順序:把index.html提到最前面。 
因主機不同,設定方法也不同。就不具體細說了。

dedecms強制去掉首頁index.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.