Apache rewrite - get original URL in PHP

后端 未结 3 824
悲&欢浪女
悲&欢浪女 2020-11-29 08:43

I have a rewrite in nginx or Apache for this address:

http://domain.com/hello

to a script like

http://domain.com/test.php&a         


        
3条回答
  •  独厮守ぢ
    2020-11-29 09:12

    You can usually find the requested URL in

    • $_SERVER['REQUEST_URI']
    • $_SERVER['REDIRECT_URL'] (maybe Apache only, don't know about nginx)

    I know you mentioned $_SERVER['REQUEST_URI'] contains your rewritten URL but in all my tests, it contains the original request.

    Why don't you dump $_SERVER and see what's in there.

提交回复
热议问题