I have my site on the server http://www.example.uk.com
.
On this server I have two domains:
one.example
two.example
I would like to get the current domain using PHP, but if I use $_SERVER['HTTP_HOST']
then it is showing me example.uk.com
instead of one.example
or two.example
.
How can I get the domain, and not the server name?
Try using this:
$_SERVER['SERVER_NAME']
Or parse:
$_SERVER['REQUEST_URI']
Reference: apache_request_headers()