1 Comments

怎么去掉织梦网站里面的index.html

发布于:2014-04-07  |   作者:织梦二次开发网  |   已聚集:人围观

最近有好些站长朋友反映他们用织梦系统搭建的网站打开网站域名老是跳转到index.html问我有没有办法去掉。

要解决这个问题首先我得搞清楚这个问题是怎么引起的,其实这个问题的出现是因为根目录下面的index.php,我们截取index.php从第14行到38行代码

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 301 Moved Permanently’);

header(‘Location:index.html’);

}

这里有一个判断,网站在不加upcache参数的情况下(www.dedevvip.com/index.php?upcache=1)和网站根目录下不存在index.html那么他就直接跳转到index.html

这样知道问题根源了,那接下来我就给出解决办法,我们分两种情况

一、直接动态浏览

网站动态访问的情况下,程序会删除根目录下面的Index.html ,那么他会执行include(dirname(__FILE__)。‘/index.html’);这段代码,把首页引用而非跳转。

 

 

二、静态访问

关于这种情况,我们这里分两种。

1、IIS

打开IIS点击文档,里面将index.html置于index.php上面,这有什么作用呢?其实这样设置就是在网站同时有index.php和index.html的情况下,先访问index,html这样就不会出现跳转的情况

 

 

2、Apache

apache里面DirectoryIndex来控制文件检索优先级的

DirectoryIndex index.html index.php index.htm

和iis一样,我们将index.html往前放


标签:(24)iis(2)apache(1)
专业承接织梦仿站,织梦模块开发,织梦插件开发,织梦模板定制,网站优化,可联系QQ:
点击这里给我发消息
飞机