POST TIME:2018-10-30 11:25
不會正則,模仿加修改(花了N多個小時),終于能正常運行了,不知道寫得對不對,說一說讓需要的友友們參考
首先,建一個web.config 放在根目錄下,web.config 內容為
<?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 后臺的“系統設置”–“基本參數設置”–“核心設置”(核心設置中的“是否使用偽靜態”把“是”選上)
這時,“文章內容顯示頁”的偽靜態已經算是設置好了。
3、如果還想將列表頁面設置成偽靜態的,則要改一下 include 目錄下的 channelunit.func.php 文件即 (include/channelunit.func.php )
大約在164行會發現這樣的代碼:
//動態
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
把這句“$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; ”注釋掉
加上下面的這幾句代碼
/**修改欄目偽靜態 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;
}
/**修改欄目偽靜態 by 163pinger***/
最后保存,好了,試一下,是不是變成偽靜態了呢?! (最后要記得,發表文章或建欄目時把“僅動態”選上