Home > CMS Tutorial > DEDECMS > dederemove index.html

dederemove index.html

藏色散人
Release: 2023-02-15 14:13:39
Original
3311 people have browsed it

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.

dederemove index.html

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__).&#39;/data/common.inc.php&#39;))
{
header(&#39;Location:install/index.php&#39;);
exit();
}
require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once DEDEINC."/arc.partview.class.php";
$GLOBALS[&#39;_arclistEnv&#39;] = &#39;index&#39;;
$row = $dsql->GetOne("Select * From `dede_homepageset`");
$row[&#39;templet&#39;] = MfTemplet($row[&#39;templet&#39;]);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row[&#39;templet&#39;]);
$pv->Display();
?>
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template