dedecms 5.6 完美實(shí)現(xiàn)偽靜態(tài)的方法附打包文件下載
發(fā)布時間:2010-09-14 09:22:43 作者:佚名
我要評論

dedecms 5.6 完美實(shí)現(xiàn)偽靜態(tài)的方法附打包文件下載
dedecms(織夢)完美實(shí)現(xiàn)偽靜態(tài)的方法
測試版本:Dedecms V5.6版本
測試平臺:Windows 7
測試環(huán)境:IIS 7.5
成功。其他條件下大同小異。
需要的條件:
1、服務(wù)器必須支持URL重寫。
2、后臺開啟偽靜態(tài)。
3、欄目設(shè)置使用動態(tài)。
4、添加文檔時選擇使用動態(tài)瀏覽。
5、修改php文件include/channelunit.func.php。
6、修改include/arc.listview.class.php。
7、編寫rewrite規(guī)則。
操作步驟:
1、加載Rewrite模塊(過程略)。
參考:http://hi.baidu.com/elsand/blog/item/96d417264b078a08908f9dcf.html
2、dedecms后臺-系統(tǒng)-系統(tǒng)基本參數(shù)-核心設(shè)置-是否使用偽靜態(tài),選“是”。
3、把欄目和文檔設(shè)置成為動態(tài)瀏覽??梢允謩?,用sql語句更快。
dedecms后臺-SQL命令行工具,執(zhí)行以下語句
將所有文檔設(shè)置為“僅動態(tài)瀏覽”:update dede_archives set ismake=-1
將所有欄目設(shè)置為“使用動態(tài)頁”:update dede_arctype set isdefault=-1
改成1就是靜態(tài)。動態(tài)轉(zhuǎn)換為靜態(tài)后需要重新生成HTML。
添加欄目和文章默認(rèn)為動態(tài)的一勞永逸的方法:
http://hi.baidu.com/elsand/blog/item/cd9fb8be6ae69e0618d81f5f.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";
其實(shí)頁可以不修改,就是URL地址會長一點(diǎn)。這個是文章頁的。
查找
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
修改為
$reurl = "/list-".$typeid.".html";
這個必須修改,是欄目頁的。
其實(shí)不修改也可以,但是URL地址會長一點(diǎn)。這個是文章的。
5、打開include/arc.listview.class.php
找到
$plist = str_replace('.php?tid=', '-', $plist);
(大約在第964行)
在其前面面添加一行
$plist = str_replace('plus/list', 'list', $plist);
這個是列表頁分頁rewrite的url格式的。
默認(rèn)是http://www.xxx.com/plus/list-1-2-3.html
現(xiàn)在是http://www.xxx.com/list-1-2-3.html
6、 設(shè)置重寫規(guī)則,在httpd.ini里面寫上:
[ISAPI_Rewrite]
# 緩存3600秒 = 1 小時(hour)
CacheClockRate 3600
RepeatLimit 32
#dedecms Rewrite規(guī)則
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、如果不使用動態(tài)首頁
把rewrite規(guī)則中的
RewriteRule ^(.*)/index\.html $1/index\.php
去掉,或改為
RewriteRule ^(.*)/index\.html $1/index\.html
否則打開http://www.xxx.com/index.html時會陷入死循環(huán)。
說明:
1、
RewriteRule ^view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$1&pageno=$2
此為文章分頁重寫命令。
2、如果view替換成自己設(shè)置的其他詞,則需要把include/arc.archives.class.php文件中的view同時替換掉。
3、重寫后的URL如下:
文章頁:http://www.xxx.com/view-1-1.html
列表頁:http://www.xxx.com/list-1.html
如果需要改成如下格式:
文章頁:http://www.xxx.com/abc/view-1-1.html
列表頁:http://www.xxx.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";
重寫規(guī)則改為:
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、偽靜態(tài)可能會出現(xiàn)多個url都是指向相同頁面,如果看重SEO效果,則可用robots.txt屏蔽多余url。
/201009/yuanma/dede56.rar
測試版本:Dedecms V5.6版本
測試平臺:Windows 7
測試環(huán)境:IIS 7.5
成功。其他條件下大同小異。
需要的條件:
1、服務(wù)器必須支持URL重寫。
2、后臺開啟偽靜態(tài)。
3、欄目設(shè)置使用動態(tài)。
4、添加文檔時選擇使用動態(tài)瀏覽。
5、修改php文件include/channelunit.func.php。
6、修改include/arc.listview.class.php。
7、編寫rewrite規(guī)則。
操作步驟:
1、加載Rewrite模塊(過程略)。
參考:http://hi.baidu.com/elsand/blog/item/96d417264b078a08908f9dcf.html
2、dedecms后臺-系統(tǒng)-系統(tǒng)基本參數(shù)-核心設(shè)置-是否使用偽靜態(tài),選“是”。
3、把欄目和文檔設(shè)置成為動態(tài)瀏覽??梢允謩?,用sql語句更快。
dedecms后臺-SQL命令行工具,執(zhí)行以下語句
將所有文檔設(shè)置為“僅動態(tài)瀏覽”:update dede_archives set ismake=-1
將所有欄目設(shè)置為“使用動態(tài)頁”:update dede_arctype set isdefault=-1
改成1就是靜態(tài)。動態(tài)轉(zhuǎn)換為靜態(tài)后需要重新生成HTML。
添加欄目和文章默認(rèn)為動態(tài)的一勞永逸的方法:
http://hi.baidu.com/elsand/blog/item/cd9fb8be6ae69e0618d81f5f.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";
其實(shí)頁可以不修改,就是URL地址會長一點(diǎn)。這個是文章頁的。
查找
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
修改為
$reurl = "/list-".$typeid.".html";
這個必須修改,是欄目頁的。
其實(shí)不修改也可以,但是URL地址會長一點(diǎn)。這個是文章的。
5、打開include/arc.listview.class.php
找到
$plist = str_replace('.php?tid=', '-', $plist);
(大約在第964行)
在其前面面添加一行
$plist = str_replace('plus/list', 'list', $plist);
這個是列表頁分頁rewrite的url格式的。
默認(rèn)是http://www.xxx.com/plus/list-1-2-3.html
現(xiàn)在是http://www.xxx.com/list-1-2-3.html
6、 設(shè)置重寫規(guī)則,在httpd.ini里面寫上:
[ISAPI_Rewrite]
# 緩存3600秒 = 1 小時(hour)
CacheClockRate 3600
RepeatLimit 32
#dedecms Rewrite規(guī)則
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、如果不使用動態(tài)首頁
把rewrite規(guī)則中的
RewriteRule ^(.*)/index\.html $1/index\.php
去掉,或改為
RewriteRule ^(.*)/index\.html $1/index\.html
否則打開http://www.xxx.com/index.html時會陷入死循環(huán)。
說明:
1、
RewriteRule ^view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$1&pageno=$2
此為文章分頁重寫命令。
2、如果view替換成自己設(shè)置的其他詞,則需要把include/arc.archives.class.php文件中的view同時替換掉。
3、重寫后的URL如下:
文章頁:http://www.xxx.com/view-1-1.html
列表頁:http://www.xxx.com/list-1.html
如果需要改成如下格式:
文章頁:http://www.xxx.com/abc/view-1-1.html
列表頁:http://www.xxx.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";
重寫規(guī)則改為:
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、偽靜態(tài)可能會出現(xiàn)多個url都是指向相同頁面,如果看重SEO效果,則可用robots.txt屏蔽多余url。
/201009/yuanma/dede56.rar
相關(guān)文章
織夢Dedecms設(shè)置偽靜態(tài)詳細(xì)方法
dedecms默認(rèn)是不支持偽靜態(tài),如果要設(shè)置偽靜態(tài)我們需要懂一點(diǎn)程序基礎(chǔ)知識了,下面我來給大家介紹在apache下實(shí)現(xiàn)Dedecms設(shè)置偽靜態(tài)方法,有需要的朋友可參考一下2013-04-21DedeCMS系統(tǒng)TAG標(biāo)簽偽靜態(tài)設(shè)置
DedeCMS的系統(tǒng)TAGS確實(shí)是一個非常好的功能,通過關(guān)鍵詞鏈接可以快速尋找到相關(guān)內(nèi)容,不過很多人希望能夠?qū)AGS靜態(tài)化這樣更加利于SEO,CIT.CN也是對此進(jìn)行了優(yōu)化和調(diào)整,只2012-11-11dedecms tag標(biāo)簽偽靜態(tài)的修改方法
dedecms tag標(biāo)簽偽靜態(tài)的修改方法,需要的朋友可以參考下。2011-08-10- DEDE雖然可以生成靜態(tài)頁面, 也可以重寫成為偽靜態(tài). 在后臺有設(shè)置可以開啟偽靜態(tài). 開啟后還要經(jīng)過一定的設(shè)置才能使用.2011-08-10
dedecms 5.5 偽靜態(tài)化ReWrite規(guī)則
dedecms 5.5 偽靜態(tài)化 ReWrite設(shè)置技巧,使用dedecms5.5的朋友可以參考下。2010-09-14dedecms5.3偽靜態(tài)及rewrite規(guī)則
因?yàn)榘呈怯没疖囶^采集自動更新 每次采集完還要手工生成一下欄目列表頁 麻煩 所以就想著把欄目頁搞成偽靜態(tài) 這個dede默認(rèn)就支持 !2010-09-14linux和windows主機(jī)實(shí)現(xiàn)dedecms偽靜態(tài)
有些朋友為了節(jié)約空間等原因,喜歡用偽靜態(tài)的,對于流量小,確實(shí)不錯,下面看下具體的方法。2010-07-19dedecms 5.3/5.5全站偽靜態(tài)含SEO重復(fù)記錄優(yōu)化
DEDECMS系統(tǒng)欄目、文章頁面、分頁面?zhèn)戊o態(tài)和域名301重定向詳細(xì)方法2010-06-30- dedecms 5.5版后臺可以開啟偽靜態(tài)功能,但是就只文章頁會被偽靜態(tài),欄目頁的鏈接依然是動態(tài)的,我們首先需要給虛擬主機(jī)添加上偽靜態(tài)規(guī)則,然后再去dedecms的相關(guān)文件中改掉2010-03-16
DEDECMS 5.1 TAG偽靜態(tài)IIS_rewrite配置方法
有時候需要在dedecms中實(shí)現(xiàn)tag的偽靜態(tài),這種表現(xiàn)方法,更利于seo,所以很多朋友喜歡。2009-06-06