if I have a file myfile.php (the dir are more)
http://SITE/A/B/myfile.php
is possible insert in the page a code that write the path where it is =
http://SITE/A/B/
and also must recognize if its url change example http to https
https://SITE/A/B/myfile.php
it write
https://SITE/A/B/