鍍金池/ 問答/PHP  Linux  Office/ 請教:phpstudy中php+nginx模式下,如何正確配置偽靜態(tài)?

請教:phpstudy中php+nginx模式下,如何正確配置偽靜態(tài)?

phpstudy中如果是在php+apache模式下,那么只需要在網(wǎng)站根目錄放.htaccess,其中配置偽靜態(tài)即可,
但是在php+nginx模式下,如何正確配置偽靜態(tài)呢?網(wǎng)站根目錄放.htaccess無效~
求教

需要配置的偽靜態(tài)如下(.htaccess中的)

RewriteRule ^down/index-details-([0-9]+)\.html down/index.php?act=down_details&id=$1
RewriteRule ^product/product-list-([0-9]+|)-([0-9]+|)\.html product/product-list.php?topclass=$1&category=$2
RewriteRule ^zerobuy/goods-list-([0-9]+|)-([0-9]+|)\.html zerobuy/goods-list.php?topclass=$1&category=$2
RewriteRule ^baike/index-show-([0-9]+)\.html baike/index.php?act=show&id=$1
RewriteRule company/index-([0-9]+)\.html company/index.php?uid=$1
RewriteRule ^product/product-show-([0-9]+)\.html product/product-show.php?id=$1
RewriteRule ^zerobuy/goods-show-([0-9]+)\.html zerobuy/goods-show.php?id=$1
RewriteRule ^zerobuy/goods-show-([0-9]+)-([0-9]+)\.html zerobuy/goods-show.php?id=$1&tid=$2
RewriteRule ^news/news-show-([0-9]+)\.html news/news-show.php?id=$1
RewriteRule ^news/news-list-([0-9]+)-([0-9]+)\.html news/news-list.php?id=$1&page=$2
RewriteRule ^news/news-list-([0-9]+)\.html news/news-list.php?id=$1
RewriteRule ^news/index.html news/index.php

求問寫在nginx中conf中的正確配置寫法

回答
編輯回答
乖乖瀦

nginx不支持.htaccess文件,這個.htaccess是針對apache的,你要想nginx 也支持rewrite,在nginxlocation中寫你的rewrite規(guī)則

2017年8月3日 04:39