How to remove the index.html in the Dream website

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Recently a number of webmaster friends reflect their dream system to build the site to open the site domain name always jump to index.html asked me if there is no way to remove.

To solve this problem first I have to figure out how this problem arose, in fact this problem arises because of the index.php under the root directory, we intercept index.php from line 14th to 38 lines of code

if (Isset ($_get[' Upcache ')) | |!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 ($cfg _basedir. $cfg _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 moved Permanently ');

Header (' Location:index.html ');

}

Here is a judge, the site without the Upcache parameter (www.dedevvip.com/index.php?upcache=1) and the site root directory does not exist index.html then he jumps directly to index.html

So know the root of the problem, then I will give a solution, we divided into two situations

Direct Dynamic Browsing

Web site dynamic access, the program will delete the root directory below the index.html, then he will execute include (DirName (__file__). '/index.html '); This code, refer to the first page rather than jump.

  

Ii. Static Access

In this case, we are divided into two kinds.

1, IIS

Open IIS click on the document, where the index.html placed on the index.php above, what is the effect? In fact, this setting is in the site at the same time index.php and index.html, the first access to index,html so there will be no jump to the situation

  

2, Apache

Apache inside DirectoryIndex to control file retrieval priority

DirectoryIndex index.html index.php index.htm

Like IIS, we put index.html forward

Reprint please indicate the source: http://www.dedevvip.com/question/11.html

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.