因为业务需求,需要在网站的二级目录下建立一个新站点shumei,新站点也要用url重写的方式访问,比如www.diannaobos.com/shumei/.......。试着配置了一下nginx的重写规则,如下:
location / { index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php last; } } location /shumei/ { index index.php index.html; if (!-e $request_filename) { rewrite ^/shumei/(.*)$ /shumei/index.php last; } }
分享:
支付宝
微信