I filter $ _SERVER ["REQUEST_URI"] so that:
$_request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);
As explained in php.net :
FILTER_SANITIZE_URL
Delete all characters except letters, numbers, and $ -_ + * '() {} | \ ^ ~ [] `<> #%"; /:.!?. @ & Amp; =
However
the browser sends this REQUEST_URI urlencode'd value, and therefore it is not sanitized in this filter_input () function. Let's say the address
http://www.example.com/abc/index.php?q=abc 123
and then the URL of the cleared request
/abc/index.php?q=abc%EF%BF%BD%EF%BF%BD123
But it must be
/abc/index.php?q=abc123
Maybe urldecode ($ _ SERVER ["REQUEST_URI"]), and then with filter_var () we can get the sanitized value.
$_request_uri = filter_var(urldecode($_SERVER['REQUEST_URI']), FILTER_SANITIZE_URL);
, "", , $_SERVER [ "REQUEST_URI" ].
, ($ _SERVER ['REQUEST_URI']), , "".
?