Simply swap out $_SERVER['REQUEST_URI']
with request_uri()
.
The reasoning is that $_SERVER['REQUEST_URI']
is Apache specific.
From the function documentation page:
Returns the equivalent of Apache's $_SERVER['REQUEST_URI'] variable.
Because $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.