I am trying to create a link in a PHP script that will take me to the main part of my address (In bold): http://localhost:8888/index.php
I could put the exact link in myself but thought if I use the $_SERVER variable then it would allow for a degree for flexibility if I move the file etc.
I did a vardump($_SERVER)
and it appears that $_SERVER['HTTP_ORIGIN']
contains the data that I require, however it also seems that this may not be an ideal variable to use:
How secure is HTTP_ORIGIN?
Is this the correct way to create a dynamic link or is there an alternative?