I need to detect if a user is accessing my site from a certain sub-domain. How can I detect the following example and flag it using PHP? I only want to detect if “abc” is the sub-domain and nothing more, but it has to work with various other domains after “abc”.
Yes, they’re on the “abc” sub-domain.
- http://domain.com/
- http://xyz.domain.com/
- http://www.domain/
- http://sub.domain.com/
- http://xyz.sub.domain.com/
No, they’re not.
This will return the subdomain: