在PHP中,如果我有域转发,我如何获得引用流量的域名?

I have three domain names. For convenience, let's call them, mainSite.com, Site1.com, and Site2.com. Site1.com and Site2.com are set up as domain forwarding to go to mainSite.com. Using PHP, on mainSite.com, is there a way to tell whether people come to the site by going through Site1.com or Site2.com? Would $_SERVER['HTTP_REFERER'], if populated, give me that information?