>백엔드 개발 >PHP 튜토리얼 >【在线等】请问这个地址怎么实现重写?

【在线等】请问这个地址怎么实现重写?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-06-23 13:52:54942검색

原始地址:
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;
        }

        if (-f $request_filename) {
            break;
        }

        # otherwise rewrite it
        if (!-e $request_filename) {
            rewrite ^(.+)$ /handler.php?_url=$1 last;
            break;
        }



不可以,真的,现在直接出现:file not found ,那个红色的框是我那个URL的pathinfo
我是这样使用的

        if (-f $request_filename) {
            break;
        }

        # otherwise rewrite it
        if (!-e $request_filename) {
            rewrite ^(.+)$ /handler.php?_url=$1 last;
            break;
        }



就算是 丢在那个 我配置的pathinfo下面,也不可以,要么是404,要么就是500错误!!!

你自己放错了位置,就不能怪别人了

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

你自己放错了位置,就不能怪别人了

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


好嘞!!!
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.