Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Re: Optimize rewrite

$
0
0
>
> 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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 53287

Latest Images

Trending Articles


Telangana Ration Card Online Status Ahara Bhadratha Card Online Status


CalCen


Waves Complete v2019.02.14 Incl Emulator-R2R


[RELEASE THREAD]--_A-Team_--Cricket_Dream_5G


MCGEE, SAMUEL O., DECEASED, OF...


WordPress: Reverse Shell


GPGT - chio bu back from market kym


Ondonga king dragged to court


Justin Guy Ballou, III


Krupt Biography, Death, Songs, Photo, Video



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>