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>
以上是规则,但写规则了,还要在代码中写入对应的实现方法!