几个有效方法去掉DedeCMS首页index.html后缀

我们有在使用织梦DedeCMS程序的时候是否有看到在打开网站首页的时候会有index.html这样子的后缀跟着。有些朋友可能忌讳这样的样式,有的会说对网站SEO有影响,实际上影响是不大的,只不过看着确实不是特别好看,如果我们有需要去掉的话也是可以的。

这里有几个方法可以去掉DedeCMS生成首页后的index.html。

1、更换index.php

<?php
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.php内容全部换成上面内容。

2、修改导航

{dede:channel type='top'}
<li><a href='[field:typeurlfunction='str_replace("index.html","",@me)'/]'>[field:typename/]</a></li> {/dede:channel}

一般index.html是因为被导航链接调用带着出来的,如果我们不点击打开就不会看到,所以我们可以修改导航,不调用。

本文出处:老蒋部落 » 几个有效方法去掉DedeCMS首页index.html后缀 | 欢迎分享( 公众号:老蒋朋友圈 )

公众号 「老蒋朋友圈」获取站长新知 / 加QQ群 【1012423279】获取商家优惠推送