nginx 虚拟环境配置隐藏URL中的index.php

 

在nginx的服务中配置:

location / {
            index  index.html index.htm index.php;
            #autoindex  on;
            if (!-e $request_filename){
                rewrite ^(.*)$ /index.php?q=$1 last;
                break;
            }
}

配置后 http://www.xxx.com/index.php/v1/ad/index?id=1 与 http://www.xxx.com/v1/ad/index?id=1    都可以访问

 

posted @ 2020-03-28 14:47  我若亦如风  阅读(507)  评论(0编辑  收藏  举报