使用织梦 DedeCMS
建站的时候,网站首页界面显示没有什么问题,但是 URL
(浏览器地址栏)中却出现了/index.html
的后缀。
对于 SEO
优化会分散网站首页权重,就算不去考虑搜索引擎优化,看着也感觉不是很爽,那么,怎么去掉这个 DedeCMS
烦人的尾巴呢?
- 一般情况下,显示
/index.html
这个后缀,都是网站服务器或者虚拟主机默认主页设置的顺序问题,只需要将index.html
默认首页的优先级设为最高就可以解决了。如果使用虚拟主机搭建的DedeCMS
网站,主机控制面板中都会有这一项。 - 对于
Web
服务器为Apache
的虚拟主机来说,只需要在.htaccess
文件中增加如下的代码即可:DirectoryIndex index.html index.htm index.php
- 如果以上的方法都无法去掉织梦
DedeCMS
首页链接默认显示的index.html
,并且确认默认首页中index.html
的优先级已经是最高,那么可以使用如下的方法,找到织梦DedeCMS
根目录下的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 `#@__homepageset`");
$row['templet'] = MfTemplet ($row['templet']);
$pv = new PartView ();
$pv -> SetTemplet ($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
$pv -> Display ();
?>
正文完
发表至: DeDeCMS
2016-06-03