nginx配置网站的二级目录项目伪静态

来源:互联网 发布:mac系统终端怎么打开 编辑:程序博客网 时间:2024/05/21 19:22

因为业务需求,需要在网站的二级目录下建立一个新项目shuicao,新项目也要用url重写的方式访问,比如www.xxx.com/shuicao/.......。试着配置了一下nginx的重写规则,如下:



        location / {            index  index.html index.htm index.php l.php;            autoindex  off;                        if (!-e $request_filename)            {                    #地址作为将参数rewrite到index.php上。                    rewrite  ^/(.*)$ /index.php/$1 last;            }        }                location /shuicao/ {            index  index.html index.htm index.php l.php;            autoindex  off;                        if (!-e $request_filename){                rewrite  ^/shuicao/(.*)$  /shuicao/index.php/$1  last;            }        }

重启nginx即可生效。

1 0
原创粉丝点击