dede method to remove index.html: 1. Replace the content of index.php to generate dynamics; 2. Directly delete the index.php file under the CMS root directory; 3. Use the htaccess file to remove index.html; 4. Set the default homepage order in the host.
The operating environment of this article: Windows 7 system, DedeCMS version 5.6, DELL G3 computer
After Dede generates the homepage by default, the link on the homepage will be followed by There is one more index.html. According to the official statement, this is beneficial to website optimization.
But this index.html is uncomfortable to look at, and it is not conducive to the unification of the homepage URL in SEO. Because the url of my website uses .htaccess to redirect to www, and ends with .com.
Therefore, in order to prevent the weight of the homepage from being dispersed, and also for aesthetic reasons, the index.html on the dede homepage must be removed.
The method for removing index.html from the dede homepage given on the Internet is as follows:
1. Replace the content of index.php according to the official update instructions to generate dynamics,
If There is no need to generate HTML for the homepage. Replace index.php with the following code
<?php 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(); ?>
Of course, it will not work if you want to generate HTML.
2. Directly delete the index.php file under the CMS root directory.
This method seems to be the simplest, but I tried it myself but failed. And you can no longer use dynamic browsing after deleting it.
3. Use .htaccess file
This method is currently used and the test was successful.
The method is as follows:
Add the following code to .htaccess in the root directory:
DirectoryIndex index.html index.php index.htm
It’s that simple.
4. Set the default homepage order in the host: bring index.html to the front.
Depending on the host, the setting method is also different. I won’t go into details.
Related recommendations: "dedecms tutorial"
The above is the detailed content of dederemove index.html. For more information, please follow other related articles on the PHP Chinese website!