I have a rewrite in nginx or Apache for this address:
http://domain.com/hello
to a script like
http://domain.com/test.php&ref=hell
How can I access this rewritten URL in PHP? Because, if I use $_SERVER['REQUEST_URI']
of course I get:
/test.php&ref=hell
but I only want:
/hello
Is this possible? Thanx for help.
Upd nginx cnf
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server
{
listen 80;
server_name domain.test;
location /
{
rewrite ^/(main|best|air)$ /core/feeds.php?act=$1 last;
proxy_pass http://127.0.0.1:8080;
}
}
In
Nginx
conf, we need to add user header withrequest_uri
:And read it in
php
:upd
for some reason nginx don't like symbol '_' in header name, don't know how it worked before, maybe something changed after nginx update. Now i'm using
and in php