国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 織夢DEDE > 正文

織夢Dedecms設置偽靜態全部方法(搜索頁,篩選頁

2024-07-12 08:51:04
字體:
來源:轉載
供稿:網友
這篇文章主要為大家詳細介紹了織夢Dedecms設置偽靜態全部方法(搜索頁,篩選頁,具有一定的參考價值,感興趣的小伙伴們可以參考一下,有需要的朋友可以收藏方便以后借鑒。一般的網站都會分幾種方式:真靜態,偽靜態,動態,眾所周知,織夢dedecms默認是真靜態模式,并不支持偽靜態路徑,如果要設置偽靜態我們需要懂一點程序基礎知識了,下面我來給大家介紹在apache下實現Dedecms設置偽靜態方法,有需要的朋友可參考一下。

 

 

首先在dede后臺開啟偽靜態(開啟的方法在系統參數-核心設置)

第一步. 首先欄目和文章最好設置成動態瀏覽. 這樣才不會生成靜態html文件.

第二步. 設置重寫規則. 在系統目錄下加一個 .htaccess文件. 內容為:

RewriteEngine On

 

RewriteRule ^plus/list-([0-9]+).html$ /plus/list.php?tid=$1

RewriteRule ^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3

RewriteRule ^plus/view-([0-9]+)-1.html$ /plus/view.php?arcID=$1

RewriteRule ^plus/view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2

 

iis文件寫法

#首頁偽靜態規則,如果不使用動態首頁,請勿必刪除這一行,否則打開首頁會出現死循環

 

RewriteRule ^(.*)/index.html $1/index.php [I]

#列表頁偽靜態規則

RewriteRule ^(.*)/category/list-([0-9]+).html $1/plus/list.php?tid=$2 [I]

RewriteRule ^(.*)/category/list-([0-9]+)-([0-9]+)-([0-9]+).html $1/plus/list.php?tid=$2&TotalResult=$3&PageNo=$4 [I]

#文章頁偽靜態規則

RewriteRule ^(.*)/archives/view-([0-9]+)-([0-9]+).html $1/plus/view.php?arcID=$2&pageno=$3 [I]

#搜索偽靜態規則

RewriteRule ^(.*)/search.html(?:(?.*))* $1/search.php?$2 [I]

#TAG標簽偽靜態規則

RewriteRule ^(.*)/tags.html $1/tags.php [I]

RewriteRule ^(.*)/tags/(.*)(?:(?.*))* $1/tags.php?/$2 [I]

RewriteRule ^(.*)/tags/(.*)/(?:(?.*))* $1/tags.php?/$2/ [I]

RewriteRule ^(.*)/tags/(.*)/([0-9])(?:(?.*))* $1/tags.php?/$2/$3 [I]

RewriteRule ^(.*)/tags/(.*)/([0-9])/(?:(?.*))* $1/tags.php?/$2/$3/ [I]

如果你的系統支持url重寫,到這里就可以用偽靜態訪問了.

第三步.更改重寫的URL.

如果用默認的設置, 訪問的URL是:

http://www.XXXX.com/plus/view-131-1.html

這樣的形色, 我們是可以更改這種樣式的.

找到文件/include/helpers/channelunit.helper.php打開.

可以看到有這樣的語句

 

return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';

這就是文章的url形式.

$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;

這是列表的重寫url.

可以使url更短一點,完成可以寫成:

return "/view-".$aid.'-1.html';

$reurl = "/list-".$typeid.".html";

這時重寫規則也要更新.

RewriteEngine On

 

RewriteRule ^list-([0-9]+).html$ /plus/list.php?tid=$1

RewriteRule ^list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3

RewriteRule ^view-([0-9]+)-1.html$ /plus/view.php?arcID=$1

RewriteRule ^view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2

更進一步,還可以把view換成自己的任何詞語,這也要把include/arc.archives.class.php文件中的view也一樣替換。

發布選項: 生成HTML 僅動態瀏覽 發文章的時候選一下也不多事。為了以后升級 盡量減少修改文件。

以下這沒有試,大家按需要測試吧~~

修改數據庫

將所有文檔設置為“僅動態”,可以進入數據庫管理中,執行下面命令:

u p date dede_archives set ismake=-1

并將ismake的默認值設置為 -1即動態。

將所有欄目設置為“使用動態頁”,可以進入數據庫管理中,執行下面命令:

u p date dede_arctype set isdefault=-1

DedeCmsTAG標簽偽靜態

DedeCms默認的TAG標簽URL,形如/tags.php?/dedecms5.7/,非常之難看。打開/include/taglib/tag.lib.php,找到lib_tag()函數下的:

$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";

 

替換為

$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";

修改分頁代碼

我們需要修改include/arc.taglist.class.php,將分頁函數替換為:

/** * 獲取動態的分頁列表

 

*

* @access public

* @param int $list_len 列表寬度

* @param string $listitem 列表樣式

* @return string

*/

function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno")

{

$prepage="";

$nextpage="";

$prepagenum = $this->PageNo - 1;

$nextpagenum = $this->PageNo + 1;

if($list_len == "" || preg_match("/[^0-9]/", $list_len))

{

$list_len = 3;

}

$totalpage = $this->TotalPage;

if($totalpage <= 1 && $this->TotalResult > 0)

{

return "<span class="pageinfo">共1頁/".$this->TotalResult."條</span>";

}

if($this->TotalResult == 0)

{

return "<span class="pageinfo">共0頁/".$this->TotalResult."條</span>";

}

$maininfo = "<span class="pageinfo">共{$totalpage}頁/".$this->TotalResult."條</span>rn";

$purl = $this->GetCurUrl();

$basename = basename($purl);

$tmpname = explode('.', $basename);

 

$purl = str_replace($basename, '', $purl).urlencode($this->Tag);

//var_dump($purl);exit;

//$purl .= "?/".urlencode($this->Tag);

 

//獲得上一頁和下一頁的鏈接

if($this->PageNo != 1)

{

$prepage.="<li><a href='".$purl."-$prepagenum'.html>上一頁</a></li>rn";

$indexpage="<li><a href='".$purl."-1.html'>首頁</a></li>rn";

}

else

{

$indexpage="<li><a>首頁</a></li>rn";

}

if($this->PageNo!=$totalpage && $totalpage>1)

{

$nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一頁</a></li>rn";

$endpage="<li><a href='".$purl."-$totalpage.html'>末頁</a></li>rn";

}

else

{

$endpage="<li><a>末頁</a></li>rn";

}

 

//獲得數字鏈接

$listdd="";

$total_list = $list_len * 2 + 1;

if($this->PageNo >= $total_list)

{

$j = $this->PageNo - $list_len;

$total_list = $this->PageNo + $list_len;

if($total_list > $totalpage)

{

$total_list = $totalpage;

}

}

else

{

$j=1;

if($total_list > $totalpage)

{

$total_list = $totalpage;

}

}

for($j; $j<=$total_list; $j++)

{

if($j == $this->PageNo)

{

$listdd.= "<li class="thisclass"><a>$j</a></li>rn";

}

else

{

$listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>rn";

}

}

$plist = '';

if(preg_match('/info/i', $listitem))

{

$plist .= $maininfo.' ';

}

if(preg_match('/index/i', $listitem))

{

$plist .= $indexpage.' ';

}

if(preg_match('/pre/i', $listitem))

{

$plist .= $prepage.' ';

}

if(preg_match('/pageno/i', $listitem))

{

$plist .= $listdd.' ';

}

if(preg_match('/next/i', $listitem))

{

$plist .= $nextpage.' ';

}

if(preg_match('/end/i', $listitem))

{

$plist .= $endpage.' ';

}

return $plist;

} 深圳白起SEO分享最詳細的織夢Dedecms設置偽靜態全部方法(搜索頁,篩選頁,問答頁)以上就是織夢Dedecms設置偽靜態全部方法(搜索頁,篩選頁的全部內容,希望對大家的學習和解決疑問有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泸州市| 郸城县| 长岭县| 正阳县| 沙湾县| 襄城县| 陈巴尔虎旗| 梓潼县| 镇沅| 佳木斯市| 保靖县| 六枝特区| 玉龙| 昌平区| 株洲县| 十堰市| 出国| 分宜县| 湾仔区| 革吉县| 汤阴县| 通州区| 建平县| 拉萨市| 南京市| 年辖:市辖区| 梧州市| 毕节市| 平谷区| 乌兰浩特市| 旺苍县| 汉川市| 云霄县| 中阳县| 洛扎县| 乌鲁木齐县| 周宁县| 北海市| 中牟县| 四川省| 利辛县|