In my nginx server, $_SERVER['REQUEST_URI']; does not work, and returns nothing. When using getenv("REQUEST_URI"); it will returns the url of the current page instead of the reffering url. And in this case, it will return the current filename (e.g. /test.php) not the full url. I have tested this on apache, and there is no problem; thus it is something related to nginx setting. Any idea?