当前位置:首页 > 服务器技术 > nginx

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

 

在nginx的服务中配置:

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

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

 

原文:https://www.cnblogs.com/cap-rq/p/12587360.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!