shopnc b2b2c偽靜態功能很簡單,但是官方偽靜態中設置的只有偽靜態商城和cms中的文章信息,但里面一些欄目跟圈子那邊都沒有使用到偽偽靜態的寫法.
在shopnc中開啟偽靜態很簡單,在/data/config/config.ini.php
在里面開啟
$config['url_model'] = true; //偽靜態開啟
這樣子就開啟了,但cms和圈子中要使用偽靜態功能還要改不少代碼,下面我就分享一個cms中在apache中偽靜態的規則給大家:
<IfModule mod_rewrite.c>
RewriteEngine on
#文章
RewriteRule ^article.html$ index.php?act=article&op=article_list
RewriteRule ^article_list_([0-9]+).html$ index.php?act=article&op=article_list&class_id=$1
RewriteRule ^article_tag_([0-9]+).html$ index.php?act=article&op=article_tag_search&tag_id=$1
RewriteRule ^article_key_((.*?)+).html$ index.php?act=article&op=article_search&keyword=$1
#畫報
RewriteRule ^picture.html$ index.php?act=picture&op=picture_list
RewriteRule ^picture_list_([0-9]+).html$ index.php?act=picture&op=picture_list&class_id=$1
RewriteRule ^picture_tag_([0-9]+).html$ index.php?act=picture&op=picture_tag_search&tag_id=$1
RewriteRule ^picture_key_((.*?)+).html$ index.php?act=picture&op=picture_search&keyword=$1
#專題
RewriteRule ^special.html$ index.php?act=special&op=special_list
RewriteRule ^special-([0-9]+).html$ index.php?act=special&op=special_detail&special_id=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#過濾服務器啟用了TRACE Method
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
# mod_fcgid & php-cgi
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
# php5apache2_2.dll
#RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
以上是規則,但寫規則了,還要在代理中寫入對應的實現方法,下次有空再把代碼發上來!
新聞熱點
疑難解答