有的站长为了使网站更易于搜索引擎收录,或者给网站后台更具神秘性,想要去掉DEDE栏目末尾的index.html。
于是就有人问:
导航里的"index.html"能不能去掉?
现在的连接地址是:xxxx/lanmu1/index.html 能不能改成:xxxx/lanmu1/ 第一解决方案:按照下面的形式修改模板即可,默认为/templets/default/head.htm:
{dede:channel type='top'}
<li><a href='http://aramey.blog.163.com/blog/[field:typeurl function='str_replace("index.htm","",@me)'/]'>[field:typename/]</a></li> {/dede:channel}
注意:'str_replace("
index.htm","",@me)'/其中的index.htm看您的实际情况换成index.html或者index.htm,否则会出错。
第二解决方案:打开include/channelunit.func.php
找到
$sitepath = MfTypedir($sitepath); 在if($isdefault==-1)前面加入 <找这段就好。>
//跳转网址
if($ispart>2){
return $typedir;
}
if($defaultname == 'index.html'){
$defaultname = '';
}
第三解决方案:
上传更新缓存即可!
以上两个解决方案都能去掉DEDE栏目默认的index.html,第一个麻烦些,还得每个栏目模板去添加、修改,不过比较灵活。
第二个是应对整个站点的功能代码,一步解决,终身不愁!哈哈!
评论