code:
$url = 'https://www.example.com/path/to/product/filename.html';
echo parse_url($url);
output:
[scheme] => https
[host] => www.example.com
[path] => /path/to/product/filename.html
How do I get the current base path, that is:
https://www.example.com/path/to/product/