POST TIME:2018-10-30 11:25
不會(huì)正則,模仿加修改(花了N多個(gè)小時(shí)),終于能正常運(yùn)行了,不知道寫(xiě)得對(duì)不對(duì),說(shuō)一說(shuō)讓需要的友友們參考
首先,建一個(gè)web.config 放在根目錄下,web.config 內(nèi)容為
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to index.php">
<match url="/index.html$" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="Rewrite to list.php">
<match url="^plus/list-([0-9]+).html$" />
<action type="Rewrite" url="plus/list.php?tid={R:1}" />
</rule>
<rule name="Rewrite to list.php?">
<match url="^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$" />
<action type="Rewrite" url="plus/list.php?tid={R:1}&TotalResult={R:2}&PageNo={R:3}" />
</rule>
<rule name="Rewrite to view.php">
<match url="^plus/view-([0-9]+)-([0-9]+).html$" />
<action type="Rewrite" url="plus/view.php?aid={R:1}&pageno={R:2}" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<globalization requestEncoding="utf-8" resp*****eEncoding="utf-8" fileEncoding="utf-8" />
</system.web>
</configuration>
2、在dedecms 后臺(tái)的“系統(tǒng)設(shè)置”–“基本參數(shù)設(shè)置”–“核心設(shè)置”(核心設(shè)置中的“是否使用偽靜態(tài)”把“是”選上)
這時(shí),“文章內(nèi)容顯示頁(yè)”的偽靜態(tài)已經(jīng)算是設(shè)置好了。
3、如果還想將列表頁(yè)面設(shè)置成偽靜態(tài)的,則要改一下 include 目錄下的 channelunit.func.php 文件即 (include/channelunit.func.php )
大約在164行會(huì)發(fā)現(xiàn)這樣的代碼:
//動(dòng)態(tài)
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
把這句“$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; ”注釋掉
加上下面的這幾句代碼
/**修改欄目偽靜態(tài) by 163pinger***/
global $cfg_rewrite;
if($cfg_rewrite == ‘Y’) {
$reurl = $GLOBALS["cfg_plus_dir"]."/list-".$typeid.".html";
}else{
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
}
/**修改欄目偽靜態(tài) by 163pinger***/
最后保存,好了,試一下,是不是變成偽靜態(tài)了呢?! (最后要記得,發(fā)表文章或建欄目時(shí)把“僅動(dòng)態(tài)”選上