This question already has an answer here:
- Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)? 11 answers
- Get the full URL in PHP 25 answers
This is my current URL structure http://wp.raddyx.in/consultant-dietitians/staff-single/#Fiona%20Brown
I am using
However it displays
/consultant-dietitians/staff-single/ only, where I want to fetch the full URL.
$_SERVER["SERVER_NAME"] to get the host name
$_SERVER["HTTPS"] to check for http vs https.
You might need
$_SERVER["SERVER_PORT"] too and some other misc things that can appear in a URL (like
You can not get the hash part of the URL (
#Fiona%20Brown) since hashes are client-side only. They are not sent to the server.
Relevant manual page: http://php.net/manual/en/reserved.variables.server.php