Reputation: 2659
I have a web directory to which several parked domain names are pointing. What I would like to do is know which domain name the visitor requested via browser address bar or link.
I will have a single handler index.php
that will determine the requested domain name and display content accordingly.
Something like: Hello, and welcome to example.com
Thanks
Upvotes: 0
Views: 266
Reputation:
You would access the superglobal $_SERVER
and its key HTTP_HOST
:
echo 'Hello, and welcome to ' , $_SERVER['HTTP_HOST'];
Upvotes: 2