Issue
Suppose there are 100 domain names pointed to my server's IP address.
and I have not set up VirtualHosts for these domains. and I do not plan on..
But what I want to do is simply extract what is before the.com
so if the domain nameis:111.com
all i want is the "111" value.my index page is a wsgi script. which means..
when these domains come to my server IP ..i can simply extract the value before the .com
depending on the value.. i can return different content..
and thus eliminate the need for creating VirtualHosts and so on via Apache and httpd.conf
is this a viable method.
if so.. i also would like to know the PHP equivalence for..SERVER_NAME
so that i can extract domains that point to my server ip.
Solution
The environ
argument passed to the WSGI application handler contains the items normally found in $_SERVER
in PHP, including a "SERVER_NAME" item.
print >>sys.stderr, environ['SERVER_NAME']
Answered By - Ignacio Vazquez-Abrams Answer Checked By - David Goodson (WPSolving Volunteer)