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