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

首頁 > CMS > 織夢DEDE > 正文

Dedecms(織夢)完美實現偽靜態的方法

2024-07-12 09:05:35
字體:
來源:轉載
供稿:網友

Dedecms(織夢)完美實現偽靜態的方法

測試版本:Dedecms V5.6版本 
測試平臺:Windows 7 
測試環境:IIS 7.5 
成功。其他條件下大同小異。 
需要的條件: 
1、服務器必須支持URL重寫。 
2、后臺開啟偽靜態。 
3、欄目設置使用動態。 
4、添加文檔時選擇使用動態瀏覽。 
5、修改php文件include/channelunit.func.php。 
6、修改include/arc.listview.class.php。 
7、編寫rewrite規則。 
操作步驟: 
1、加載Rewrite模塊(過程略)。 
2、dedecms后臺-系統-系統基本參數-核心設置-是否使用偽靜態,選“是”。 
3、把欄目和文檔設置成為動態瀏覽。可以手動,用sql語句更快。 
dedecms后臺-SQL命令行工具,執行以下語句 
將所有文檔設置為“僅動態瀏覽”:update dede_archives set ismake=-1 
將所有欄目設置為“使用動態頁”:update dede_arctype set isdefault=-1 
改成1就是靜態。動態轉換為靜態后需要重新生成HTML。 
添加欄目和文章默認為動態的一勞永逸的方法: 
4、修改php文件include/channelunit.func.php 
查找 
return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.’-1.html’; 
修改為 
return “/view-”.$aid.’-1.html’; 
查找 
return $GLOBALS['cfg_phpurl'].”/view.php?aid=$aid”; 
修改為 
return “/view.php?aid=$aid”; 
其實頁可以不修改,就是URL地址會長一點。這個是文章頁的。 
查找 
$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid; 
修改為 
$reurl = “/list-”.$typeid.”.html”; 
這個必須修改,是欄目頁的。 
其實不修改也可以,但是URL地址會長一點。這個是文章的。 
5、打開include/arc.listview.class.php 
找到 
$plist = str_replace(‘.php?tid=’, ‘-’, $plist); 
(大約在第964行) 
在其前面面添加一行 
$plist = str_replace(‘plus/list’, ‘list’, $plist); 
這個是列表頁分頁rewrite的url格式的。 
默認是http://www.CUOxin.com/plus/list-1-2-3.html 
現在是http://www.CUOxin.com/list-1-2-3.html 
6、 設置重寫規則,在httpd.ini里面寫上: 
[ISAPI_Rewrite] 
# 緩存3600秒 = 1 小時(hour) 
CacheClockRate 3600 
RepeatLimit 32 
#dedecms Rewrite規則 
RewriteRule ^(.*)/index/.html$1/index/.php 
RewriteRule ^(.*)/list-([0-9]+)/.html$1/plus/list/.php/?tid=$2 
RewriteRule^(.*)/list-([0-9]+)-([0-9]+)-([0-9]+)/.html$1/plus/list/.php/?tid=$2&TotalResult=$3&PageNo=$4 
RewriteRule^(.*)/view-([0-9]+)-([0-9]+)/.html $1/plus/view/.php/?arcID=$2&pageno=$3 
7、如果不使用動態首頁 
把rewrite規則中的 
RewriteRule ^(.*)/index/.html $1/index/.php 
去掉,或改為 
RewriteRule ^(.*)/index/.html $1/index/.html 
否則打開http://www.CUOxin.com/index.html時會陷入死循環。 
說明: 
1、 
RewriteRule ^view-([0-9]+)-([0-9]+)/.html$/plus/view.php?aid=$1&pageno=$2 
此為文章分頁重寫命令。 
2、如果view替換成自己設置的其他詞,則需要把include/arc.archives.class.php文件中的view同時替換掉。 
3、重寫后的URL如下: 
文章頁:http://www.CUOxin.com/view-1-1.html 
列表頁:http://www.CUOxin.com/list-1.html 
如果需要改成如下格式: 
文章頁:http://www.CUOxin.com/abc/view-1-1.html 
列表頁:http://www.CUOxin.com/abc/list-1.html 
include/channelunit.func.php中 
return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.’-1.html’; 
改為 return “/abc/view-”.$aid.’-1.html’; 
return $GLOBALS['cfg_phpurl'].”/view.php?aid=$aid”; 
改為 return “/abc/view.php?aid=$aid”; 
$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid; 
改為 $reurl = “/abc/list-”.$typeid.”.html”; 
重寫規則改為: 
RewriteRule ^(.*)/index/.html $1/index/.php 
RewriteRule^(.*)/abc/list-([0-9]+)/.html $1/plus/list/.php/?tid=$2 
RewriteRule^(.*)/abc/list-([0-9]+)-([0-9]+)-([0-9]+)/.html$1/plus/list/.php/?tid=$2&TotalResult=$3&PageNo=$4 
RewriteRule^(.*)/abc/view-([0-9]+)-([0-9]+)/.html$1/plus/view/.php/?arcID=$2&pageno=$3 

4、偽靜態可能會出現多個url都是指向相同頁面,如果看重SEO效果,則可用robots.txt屏蔽多余url。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 曲麻莱县| 元谋县| 滁州市| 达尔| 庄浪县| 辉县市| 洮南市| 三门县| 东乡族自治县| 康定县| 哈密市| 南江县| 会东县| 鞍山市| 温宿县| 商河县| 涞源县| 英吉沙县| 临夏县| 东宁县| 康马县| 西丰县| 镇平县| 岳阳市| 哈密市| 张家川| 兴安盟| 浦东新区| 名山县| 博白县| 灵山县| 宣汉县| 毕节市| 苍山县| 望江县| 陇南市| 湄潭县| 乌兰察布市| 石泉县| 台北市| 阿尔山市|