I have the following php variable
$currentUrl
This php variable returns me the current url page. For example: it returns:
http://example.com/test-category/page.html?_ore=norn&___frore=norian
What php code can i use that will take this url link and delete everything after ".html" and would return me a clean url link, for example:
http://example.com/test-category/page.html
This would be returned in a new variable $clean_currentUrl
With PHP's parse_url()
<?php 
$url = "http://example.com/test-category/page.html?_ore=norn&___frore=norian";
$url = parse_url($url);
print_r($url);
/*
Array
(
    [scheme] => http
    [host] => example.com
    [path] => /test-category/page.html
    [query] => _ore=norn&___frore=norian
)
*/
?>
Then you can build your desired url from the values.
$clean_url = $url['scheme'].'://'.$url['host'].$url['path'];
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With