Drop the index.html in the dream website

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.