在讓網(wǎng)站全部都是偽靜態(tài)的時(shí)候首先就要確保自己的空間或服務(wù)器是不是支持偽靜態(tài),也就是url重寫(xiě),如果支持的話才可以設(shè)置,否則是不能設(shè)置的。
登陸織夢(mèng)后臺(tái)開(kāi)始偽靜態(tài),在“系統(tǒng)”->“核心設(shè)置”->“是否使用偽靜態(tài)”
首頁(yè)偽靜態(tài)
首先就要把站點(diǎn)根目錄下的index.html刪除,在以后更新的時(shí)候不要更新生成html文件就可以了
設(shè)置欄目和文章就在欄目列表選項(xiàng)中選擇使用動(dòng)態(tài)頁(yè)瀏覽,在文章發(fā)布的時(shí)候也選擇僅動(dòng)態(tài)瀏覽。
打開(kāi)/include/helpers/channelunit.helper.php
將GetFileName()中的如下代碼: //動(dòng)態(tài)文章
if($cfg_rewrite == 'Y')
{
return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
}
替換為 //動(dòng)態(tài)文章
if($cfg_rewrite == 'Y')
{
return "/archives/view-".$aid.'-1.html';
}
將文章頁(yè)默認(rèn)的 /plus/view-1-1.html鏈接格式改為 /archives/view-1-1.html
將GetTypeUrl()中的如下代碼: //動(dòng)態(tài)
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
替換為 //動(dòng)態(tài)
$reurl = "/category/list-".$typeid.".html";
將頻道或是列表頁(yè)URL變更為/category/list-1.html形式。
列表分頁(yè)偽靜態(tài)
打開(kāi)/include/arc.listview.class.php,找到獲取動(dòng)態(tài)的分頁(yè)列表GetPageListDM()函數(shù)末尾處:
$plist = str_replace('.php?tid=', '-', $plist);
替換為
$plist = str_replace('plus', 'category', $plist);
將默認(rèn)的plus替換成
category$plist = str_replace('.php?tid=', '-', $plist);
將列表分頁(yè)默認(rèn)鏈接格式 /plus/list-1-2-1.html修改為/category/list-1-2-1.html
DEDECMS文章分頁(yè)偽靜態(tài)
打開(kāi)/include/arc.archives.class.php,找到獲取動(dòng)態(tài)的分頁(yè)列表GetPagebreakDM()函數(shù)末尾處:
$PageList = str_replace(".php?aid=","-",$PageList);
替換為
$plist = str_replace('plus', 'archives', $plist);
將默認(rèn)的plus替換成
archives$PageList = str_replace(".php?aid=","-",$PageList);
TAG標(biāo)簽偽靜態(tài)
打開(kāi)/include/taglib/tag.lib.php,找到lib_tag()函數(shù)下的:
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
替換為
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
搜索偽靜態(tài)
一種偷懶的方法,將搜索URL中“search.php?…”直接替換為“search.html?…”,至于“?”號(hào)之后的參數(shù)以任意字符進(jìn)行匹配。
依次打開(kāi)include文件夾下的channelunit.func.php、arc.searchview.class.php、arc.taglist.class.php以及/include/taglib/hotwords.lib.php,查找“search.php?”替換為“search.html?”即可。