pasckr 发表于 2016-5-9 15:31:29

dedecms织梦程序首页如何去除index.html




                 DEDECMS织梦CMS建站程序用户会发现,输入地址后,而打开的实际地址后面有个index.html,下面飞花如梦就和大家一起分享下这个问题的两种解决方法:

1、把网站默认首页index.html放到index.php前面,这样它自动读到index.html就不会跳转了

2、把DEDECMS的index.php更改为

<?php   //自动生成HTML版       require_once (dirname(__FILE__) . &quot;/include/common.inc.php&quot;);       require_once DEDEINC.&quot;/arc.partview.class.php&quot;;       $GLOBALS['_arclistEnv'] = 'index';       $row = $dsql->GetOne(&quot;Select * From `#@__homepageset`&quot;);       $row['templet'] = MfTemplet($row['templet']);       $pv = new PartView();       $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . &quot;/&quot; . $row['templet']);       $pv->SaveToHtml(dirname(__FILE__).'/index.html');       include(dirname(__FILE__).'/index.html');       exit();   ?>
<?php
//自动生成HTML版
require_once (dirname(__FILE__) . &quot;/include/common.inc.php&quot;);
require_once DEDEINC.&quot;/arc.partview.class.php&quot;;
$GLOBALS['_arclistEnv'] = 'index';
$row = $dsql->GetOne(&quot;Select * From `#@__homepageset`&quot;);
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . &quot;/&quot; . $row['templet']);
$pv->SaveToHtml(dirname(__FILE__).'/index.html');
include(dirname(__FILE__).'/index.html');
exit();
?>

其实主要就是把那段301定向代码删除

header(&lsquo;HTTP/1.1 301 Moved Permanently&rsquo;);
header(&lsquo;Location:index.html&rsquo;);

以上两种方法绝对能解决dedecms首页地址不带index.html。
页: [1]
查看完整版本: dedecms织梦程序首页如何去除index.html