DEDECMS TAG偽靜態(tài) IIS_rewrite配置方法附rewrite下載
更新時間:2008年10月15日 21:35:24 作者:
使dedecms出現(xiàn)的偽靜態(tài)效果實現(xiàn)代碼
方法
1、因為沒有像PHP自帶的ReWrite模塊,所以需要下載IIS Rewrite模塊:
http://www.dbjr.com.cn/softs/6192.html
2、將壓縮包解壓到任意目錄,(如:C:\Rewrite)。然后打開“控制面板”-“管理工具”-“IIS信息服務管理器”-“網(wǎng)站”-“您的站點
”-“屬性”。在“ISAPI篩選器”項點擊 “添加”,篩選器名稱填入Rewrite,可執(zhí)行文件為C:\Rewrite\Rewrite.dll ;
3、然后修改httpd.ini 文件,添加相應的過濾規(guī)則,例如:
RewriteRule ^(.*)/([a-z0-9\-\_]+)$ $1/Default\.aspx\?id=$2 [I,O]
http://localhost/Text 就會等同于 http://localhost/Default.aspx?id=Text
RewriteRule ^(.*)/id_([a-z0-9\-]+)\.html$ $1/Default\.aspx\?id=$2 [I,O]
http://localhost/id_Text.html 就會等同于 http://localhost/Default.aspx?id=Text
^(.*)/html/([0-9]+)/([0-9]+)\.html$ $1/Default\.aspx\?id=$2&name=$3
http://localhost/html/001/007.html 就等同于 http://localhost/Default.aspx?id=001&name=007
DEDE的添加方法(注意:這里是正則方式):
RewriteRule ^(.*)/tag/(.+)$ $1/tag\.php\?$2/
RewriteRule ^(.*)/tag/(.+)\.html$ $1/tag\.php\?$2
4、重新啟動IIS就可以生效了(這一步很重要,每次修改httpd.ini后都要重啟 IIS 以加載配置。)
5、然后修改DEDE相關函數(shù):
\include\inc_arcpart_view.php
\include\inc_channel_unit_functions.php
\include\inc_pubtag_make.php
\include\inc_taglist_view.php
即:把所有鏈接改為靜態(tài)地址:tag.php?/ ->tag/
然后再生成相關頁面就可以了。
1、因為沒有像PHP自帶的ReWrite模塊,所以需要下載IIS Rewrite模塊:
http://www.dbjr.com.cn/softs/6192.html
2、將壓縮包解壓到任意目錄,(如:C:\Rewrite)。然后打開“控制面板”-“管理工具”-“IIS信息服務管理器”-“網(wǎng)站”-“您的站點
”-“屬性”。在“ISAPI篩選器”項點擊 “添加”,篩選器名稱填入Rewrite,可執(zhí)行文件為C:\Rewrite\Rewrite.dll ;
3、然后修改httpd.ini 文件,添加相應的過濾規(guī)則,例如:
RewriteRule ^(.*)/([a-z0-9\-\_]+)$ $1/Default\.aspx\?id=$2 [I,O]
http://localhost/Text 就會等同于 http://localhost/Default.aspx?id=Text
RewriteRule ^(.*)/id_([a-z0-9\-]+)\.html$ $1/Default\.aspx\?id=$2 [I,O]
http://localhost/id_Text.html 就會等同于 http://localhost/Default.aspx?id=Text
^(.*)/html/([0-9]+)/([0-9]+)\.html$ $1/Default\.aspx\?id=$2&name=$3
http://localhost/html/001/007.html 就等同于 http://localhost/Default.aspx?id=001&name=007
DEDE的添加方法(注意:這里是正則方式):
RewriteRule ^(.*)/tag/(.+)$ $1/tag\.php\?$2/
RewriteRule ^(.*)/tag/(.+)\.html$ $1/tag\.php\?$2
4、重新啟動IIS就可以生效了(這一步很重要,每次修改httpd.ini后都要重啟 IIS 以加載配置。)
5、然后修改DEDE相關函數(shù):
\include\inc_arcpart_view.php
\include\inc_channel_unit_functions.php
\include\inc_pubtag_make.php
\include\inc_taglist_view.php
即:把所有鏈接改為靜態(tài)地址:tag.php?/ ->tag/
然后再生成相關頁面就可以了。
相關文章
參考Dedecms整合Discuz完全攻略實現(xiàn)最新的結(jié)合
看到還有很多同學和我一樣,說配置不成功,經(jīng)測試及同學們的指點,我整合成功了,以下是配置過程,供大家參考2008-06-06實現(xiàn)讓DeDecms的上下文章鏈接限制在當前欄目內(nèi)
使用dedecms的時候,當打開某篇文章的時候,底部會有“上一篇”“下一篇”的鏈接信息,默認情況下,上下鏈接信息并沒有區(qū)分欄目的屬性,那么需要實現(xiàn)本欄目內(nèi)的上下篇,如何實現(xiàn)呢? 基本思路:實現(xiàn)上下文章鏈接的函數(shù)位于GetPreNext(),我們在這個函數(shù)中獲得欄目ID,然后修改SQL語句,在查詢數(shù)據(jù)庫的時候加上欄目ID的限制。2008-03-03