Optimize rewrite

Anto potxoka at gmail.com
Thu Jun 20 14:37:15 UTC 2013


Ok, thanks !!! ;-)




2013/4/4 Reinis Rozitis <r at roze.lv>

>
>> location / {
>>         rewrite    ^/(.*)/(.*)$      /$1/index.php?url=$2;
>>    }
>>
>
> I would suggest to use try_files:
>
> location / {
>        try_files $uri $uri/ /index.php?url=$uri&$args;
> }
>
>
> Personally instead of pasing the uri in the 'url' param I like to use
> try_files $uri $uri/ /index.php?$args; and then in the php code have the
> url in $_SERVER['REQUEST_URI'] (or $_SERVER['DOCUMENT_URI']) that way there
> is no possibility to accidentaly mess with the GET variables.
>
>
> rr
> ______________________________**_________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/**mailman/listinfo/nginx<http://mailman.nginx.org/mailman/listinfo/nginx>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130620/13a99c9d/attachment.html>


More information about the nginx mailing list