• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    去掉DedeCms首页网址带index.html路径方法
    POST TIME:2019-09-30 14:01

    默认的DEDECMS首页生成静态后,打开我们所用DEDECMS搭建的网站会在域名后面加上index.html路径,一来看的不是太美观,而来传言对SEM有所影响。
    那就得想办法去掉,最简单的方法就是把DEDECMS根目录下的index.php内中的代码全部替换成如下:

    <?php
    /**
    * @version $Id: index.php 1 9:23 2010-11-11 tianya $
    * @package DedeCMS.Site
    * @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
    * @license http://help.dedecms.com/usersguide/license.html
    * @link http://www.dedecms.com
    */
    /*
    if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
    {
    header('Location:install/index.php');
    exit();
    }
    //自动生成HTML版
    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');
    }
    */
    /*替换为以下代码*/
    if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
    {
    header('Location:install/index.php');
    exit();
    }
    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']);
    $pv->Display();
    ?>


    就这么简单,替换后即可。清空下你的浏览器缓存,然后再打开看看,是不是index.html没有了。

    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!