天天看點

destoon7.0詳情頁url根目錄化以子產品目錄名區分

詳情頁url根目錄化,為了不沖突,教程就以子產品目錄名去分辨網址

原網址 www.***.com/sell/show-100.html

改變後形成的最終效果為 www.***.com/sell-100.html

規則注解其中:

sell為自動識别子產品目錄名

–  為分割線

100為資訊id值

開發方法如下:

1、找到總函數檔案 include/global.func.php

搜尋

$itemid = $item[\'itemid\'];      

在其上面換行加上

$moduledir = $MOD[\'moduledir\'];      

2、找到url規則檔案 api/url.inc.php

搜尋

$urls[\'php\'][\'item\'][4] = array(\'example\'=>\'(\'.$L[\'url_rewrite\'].\') show/1/\',\'index\'=>\'show/{$itemid}/\', \'page\'=>\'show/{$itemid}/{$page}/\');      

在下面加上

$urls[\'php\'][\'item\'][5] = array(\'example\'=>\'(\'.$L[\'url_rewrite\'].\') moduledir-1-2.html\',\'index\'=>\'../{$moduledir}-{$itemid}.html\', \'page\'=>\'../{$moduledir}-{$itemid}-{$page}.html\');      

3、僞靜态規則,目前隻提供兩個版本的,其他自行轉行

3-1、nginx版

#根目錄化S
rewrite ^(.*)-([0-9]+)([\\-])?([0-9]+)?\\.html$ $1/show.php?itemid=$2&page=$4 last;
#根目錄化E      

3-2、apache版規則

#根目錄化S
RewriteRule ^(.*)-([0-9]+)([\\-])?([0-9]+)?\\.html$ $1/show.php?itemid=$2&page=$4
#根目錄化E