織夢dedecms如何去掉域名后面的index.html

織夢dedecms如何去掉域名后面的index.html

為什么要去掉導航鏈接里的index.html?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(推薦學習:織夢cms

雖然說這兩個鏈接的意思一樣,鏈接到的網址也一樣,但是從優化角度來說去掉鏈接里的index.html要比后者權重高一點。

dedecms去掉導航鏈接里的index.html有兩種方法:

1.修改模板內的對應標簽,從而去掉對應鏈接的index.html.

立即學習前端免費學習筆記(深入)”;

在出現欄目鏈接的標簽里(不局限于channe,l,list,arclist) ,只要是能調用出來欄目鏈接的dede標簽都可以使用這個方法。

方法如下:

在標記內加入下面的代碼

function='str_replace("index.htm","",@me)'

注意:’str_replace(“index.htm”,””,@me)’/其中的index.htm看您的實際情況換成index.html或者index.htm。

例子:

{dede:arclist??function='str_replace("index.htm","",@me)'}...底層調用{/dede:arclist} {dede:list??function='str_replace("index.htm","",@me)'}...底層調用{/dede:list}

2.修改程序文件,一次性替換所有欄目鏈接的index.html.

需要修改的文件:include/channelunit.func.php

找到if($isdefault==-1)

在前面加入

//跳轉網址 if($ispart>2){  return?$typedir; } ? if($defaultname?==?'index.html'){  $defaultname?=?''; }

注意:其中的index.html看您的實際情況換成index.html或者index.htm

修改完成后,然后重新生成即可。

? 版權聲明
THE END
喜歡就支持一下吧
點贊12 分享