At the very beginning, some of the website leaders reflected that they used the website built by the dream system to open the website domain name. The old website name was resolved to index.html and asked me if I could remove it. To solve this problem, first of all, I have to figure out how this problem is caused.
At the very beginning, some of the website leaders reflected that they used the website built by the dream system to open the website domain name. The old website name was resolved to index.html and asked me if I could remove it.
To solve this problem, first I have to figure out how this problem is caused. In fact, this problem occurs because of the index under the root directory. php. we can intercept the index. php code lines from 14th to 38
If (isset ($ _ GET ['pcache']) |! 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 ($ pai_basedir. $ pai_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 ');
}
Here is a judgment that the website does not add the upcache parameter (www.dedevvip.com/index.php? The website root directory does not contain index.html. you can directly access index.html.
Now that we know the root cause of the problem, we will provide a solution in two ways.
1. direct dynamic browsing
When the website is dynamic, the program deletes index.html from the root directory, and then it executes include (dirname (_ FILE __). '/Index.html.
II. static access
In this case, we have two types.
1. IIS
Open the iisclick document and place index.html on index. php. what is the role of index.html? In fact, when the website has index.php and index.html at the same time, access the index first, and the html will not jump.
2. Apache
In apache, DirectoryIndex is used to control the priority of file retrieval.
DirectoryIndex index.html index. php index.htm
In the same way as iis, we put index.html forward