I'm using this variable to get the current page URL, like this:
$request = $_SERVER["REQUEST_URI"]; $page = (is_ssl() ? 'https' : 'http').'://'; if ($_SERVER["SERVER_PORT"] != "80") $page .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$request; else $page .= $_SERVER["SERVER_NAME"].$request;
The app. I doing this for is public, and the problem is that on some sites (very rare) this variable returns the entire URL, including the domain name, not just the requested page. Is this a server misconfiguration?
It could be somewhere in your code (or 3rd party package) is changing this variable.
grep -r -E '\$_SERVER\[[\'"]?REQUEST_URI[\'"]?\]\s?=[^=]+?'
That regex should find where
$_SERVER['REQUEST_URI] is being assigned, and not just used normally or testing for equality, for example. Note too I removed the
-i flag because PHP variables are case sensitive and so are array keys.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki