Let’s say my current url is
http://domain.com/category/clothing-personal-items/&page=3
I used $_SERVER["REQUEST_URI"] to get current request uri.
$url = $_SERVER["REQUEST_URI"];
print_r(parse_url($url));
echo parse_url($url, PHP_URL_PATH);
The array ouput
Array
(
[path] => /category/clothing-personal-items/&page=3
)
Question :
How do I retrieve only /category/clothing-personal-items/ or remove any query after /category/clothing-personal-items/
1 Answer