Home >Backend Development >PHP Tutorial >【】请教这个地址如何实现重写

【】请教这个地址如何实现重写

WBOY
WBOYOriginal
2016-06-13 12:03:16993browse

【在线等】请问这个地址怎么实现重写?
原始地址:
http://172.16.46.40/api/handler.php/user/1/get_info/6

现在需要在nginx 里面配置 最终得到这样的结果,就是
可以通过访问
http://172.16.46.40/api/user/1/get_info/6  一样可以正常访问,请问在Nginx里面怎么配置?  
------解决方案--------------------
        if (-f $request_filename) {
            break;
        }

        # otherwise rewrite it
        if (!-e $request_filename) {
            rewrite ^(.+)$ /handler.php?_url=$1 last;
            break;
        }
------解决方案--------------------
你自己放错了位置,就不能怪别人了

       location /{<br />               index index.html index.htm index.php;<br />               if (-e $request_filename) {<br />                       break;<br />               }<br />               if (!-e $request_filename) {<br />                       rewrite ^(.+)$ /handler.php?_url=$1 last;<br />                       break;<br />               }<br />       }<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn