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.
Getting Server Name From URL
Moderator: General Moderators
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: Getting Server Name From URL
There was a similar post about this issue within the last couple days, and Chris does a good job of laying it out:
http://shiflett.org/blog/2006/mar/serve ... -http-host
Consider:
http://shiflett.org/blog/2006/mar/serve ... -http-host
Consider:
Code: Select all
telnet www.MYbusiness.com 80
telnet> GET / HTTP/1.1
Host: www.YOURbusiness.comRe: Getting Server Name From URL
I figured this out... Incase anyone else comes up against this,
The user was supposed to point their domain name to our IP address. Instead, the user had the registrar point their domain name to our domain name. Apparently when this is done, It does not take the URL in the URL bar. Instead it takes the actual server's domain.
I have a video that a user can watch to see the exact steps and how to set this up, but...
Build it idiot proof, and I can find a better idiot.
FYI - Roughly 150 people have set up their websites with out this occurring...
The user was supposed to point their domain name to our IP address. Instead, the user had the registrar point their domain name to our domain name. Apparently when this is done, It does not take the URL in the URL bar. Instead it takes the actual server's domain.
I have a video that a user can watch to see the exact steps and how to set this up, but...
Build it idiot proof, and I can find a better idiot.
FYI - Roughly 150 people have set up their websites with out this occurring...