简体   繁体   中英

Finding a redirected url to current php page via NginX rewrite or redirect

I am using nginx to redirect all non-exists subdirectories to another directory called '/report'. I do have a php file there to record IP address of the URI originator. Can I know the actual subdirectory my users initially tried to connect? In other words, is is possible to find out (using php) it the query was redirected or not?

It depends on how you are making the rewrite/redirect.

Internal redirection using either try_files or rewrite...last will not change the original URI ( $request_uri ) which is usually presented to PHP as REQUEST_URI in the $_SERVER var.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM