Getting Server Name From URL
Posted: Mon May 10, 2010 10:27 am
I have a site that allows users to point their URL to my server, I then use $_SERVER['SERVER_NAME'] to look up their account, and apply their settings to their site (their company name, some pictures, content, contact info, etc.). This has been working fine for the first 180 websites signed up. I just had a user sign up that when her URL is entered, it pulls another user's content.
As I looked into it, $_SERVER['SERVER_NAME'] is pulling the wrong data. To preserve my client's anonymity, we'll say that website "www.MYbusiness.com" is typed in the browser. When I pull the server name from the URL, I get "www.YOURbusiness.com". NOTE: "www.yourbusiness.com" is another user's website in the system.
All other accounts appear to be working fine.
Based on what I have read online, the issue seems to be with Apache setting $_SERVER['SERVER_NAME'] to the wrong URL for some reason.
As I looked into it, $_SERVER['SERVER_NAME'] is pulling the wrong data. To preserve my client's anonymity, we'll say that website "www.MYbusiness.com" is typed in the browser. When I pull the server name from the URL, I get "www.YOURbusiness.com". NOTE: "www.yourbusiness.com" is another user's website in the system.
All other accounts appear to be working fine.
Based on what I have read online, the issue seems to be with Apache setting $_SERVER['SERVER_NAME'] to the wrong URL for some reason.