我在nginx或Apache中重写了这个地址:
http://domain.com/hello
Run Code Online (Sandbox Code Playgroud)
像一个脚本
http://domain.com/test.php&ref=hell
Run Code Online (Sandbox Code Playgroud)
如何在PHP中访问此重写的URL?因为,如果我$_SERVER['REQUEST_URI']当然使用我得到:
/test.php&ref=hell
Run Code Online (Sandbox Code Playgroud)
但我只想要:
/hello
Run Code Online (Sandbox Code Playgroud)
这可能吗?Thanx寻求帮助.
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;
}
}
Run Code Online (Sandbox Code Playgroud)