How do I check if the URL accessing the page is the original URL or if it’s a CNAME record.
For example, I have a site domain.com. Users can setup a CNAME where they link www.otherdomain.com to our site domain.com.
From our server point of view, how can I detect if the URL accessing the page is the actual one (domain.com) or the CNAME one (www.otherdomain.com)?
I think you have to query a DNS to know it, since this information does not usually come in request headers.
Take a look at the dns_get_record and checkdnsrr functions in PHP documentation.