$path = \'/home/to//my///site\';
I am trying to remove unnecessary forward slashes / from the path above
/
I am trying to get this
if someone wants to remove extra slashes from URL without removing first two slashes after http/https:
$url = preg_replace('/([^:])(\/{2,})/', '$1/', $url);
(thanks to ツ Liverbool how to remove multiple slashes in URI with 'PREG' or 'HTACCESS')