nginx下偽靜態規則與在apache中有點一區別以前是我按apache的方法發現有一點問題,后來在網上找到一些方法下面給各位整理一下.
我phpcms v9網站主機是華夏名網的,服務器是nginx1.2.1的,我在自定義偽靜態里面寫的偽靜態規則是:
rewrite ^tag/(.*) index.php?m=content&c=tag&a=lists&tag=$1 last;
但是不起作用,問客服,連偽靜態的概念都沒弄清楚,經過一番摸索,正確的nginx下的偽靜態規則寫法是:
rewrite ^/tag/(.*)$ /index.php?m=content&c=tag&a=lists&tag=$1 last;
上部份來自小談博客,現再詳細把其它頁面的都加上如下代碼:
- location / {
- ###以下為PHPCMS 偽靜態化rewrite規則
- rewrite ^(.*)show-([0-9]+)-([0-9]+).html$ $1/show.php?itemid=$2&page=$3; 效果 show-12-120-1.html show-欄目id-文章id-頁數.html
- rewrite ^(.*)list-([0-9]+)-([0-9]+).html$ $1/list.php?catid=$2&page=$3; 效果 content-12-120-1.html content-欄目id-文章id-頁數.html
- rewrite ^(.*)show-([0-9]+).html$ $1/show.php?specialid=$2;
- //開源軟件:Vevb.com
- rewrite ^/tag-([^.]*)-([0-9]+)-([0-9]+).html /index.php?m=content&c=tag&catid=$2&tag=$1&page=$3;
- rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=comment&c=index&a=init&commentid=content_$1-$2-$3;
- rewrite ^/([^.]*).html /index.php?m=member&c=index&a=$1;
小編提示您,當然我們還可以使用.htaccess來實現.
新聞熱點
疑難解答