Thursday, 15 September 2011

php - Get all information after URL question mark in Nginx -



php - Get all information after URL question mark in Nginx -

i attempting create page allows me visit www.example.com/create?453lk6m4y , create business relationship linked id through page createuser.php?id=453lk6m4y. issue i'm running if pass straight php script, request sets key 453lk6m4y , value nothing.

in other words, if visit url, page understands request

array ( [453lk6m4y] => )

i wanted rewrite url via nginx rewrites. have far:

rewrite ^/create(\?.*)?$ /createuser.php?id=$1 last; #user creation page

however, rewrite changes request reflect following:

array ( [id] => [453lk6m4y] => )

any ways rewrite url request reflect

array ( [id] => 453lk6m4y )

first i'm not sure if www.example.com/create?453lk6m4y valid url:

? defined separater between location , (get)parameters get parameters of of form <parameter>=<value>, & separator between different parameters

that said if @ http://wiki.nginx.org/httpcoremodule#variables you'll see standard variables available in nginx:

specifically $args-variable hold whole of parameters, i.e. after ? you have $arg_parameter-variables, access individual parameter values. (so if have url example.org/createuser.php?id=1234&page=abc have variable $arg_id value 1234 , variable $arg_page value abc)

php nginx

No comments:

Post a Comment