Jared Green asked:
I am building office management software on a LAMP server on a SAAS model. My clients typically have 5-10 thousand customers they are tracking with all of their contact, invoicing, appointment information. I want to keep each clients information in a separate Database. This I believe will in the long run improve performance, ensure better separation of data, and be cleaner.
So what I want to have happen is for company1.mysite.com and company2.mysite.com to both point to the same site, but pass on their subdomain as a parameter to php.
How do I use apache and vhosts to pass on the subdomain as a parameter to php while still using the same application for all subdomains.
This probably belongs on Stack Overflow, but…
In your PHP code, you check the value of
$_SERVER['HTTP_HOST'] to determine the hostname which was used.
In your Apache
<VirtualHost> use a wildcard
ServerAlias to serve all possible subdomains of the domain name from the same virtual host.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.