Replace $_SERVER['REQUEST_URI'] with request_uri()