Reputation: 597
Is there a free PHP script that allows you to easily add a virtualhost?
I need to do this, because I'll be opening a free forum host, and want to allow users to use their own domain, aside from a free subdomain.
Upvotes: 2
Views: 856
Reputation: 11
Easy way is to wildcard all domains to a set directory then there use mod rewrite to map the specific domains to specific directories or in the case of say a MU wordpress install you can use the domain to map to a user account.
you can edit the .htaccess file on the fly without restarting apache.
Upvotes: 1
Reputation: 4693
couldnt php create a vhost file which is included in the main vhost handle this? using cron to determine weather there has been updates to the attached vhost you could reload apache
Upvotes: 0
Reputation: 35149
Restarting the server whenever you add a new domain to it could be problematic. If there was ever a problem writing the file, you lose all the sites, and if there is data cached (I'm thinking mainly about APC), you also lose the usefulness of the cache.
Having the default virtual host handle the new domains, and then having the PHP code acting according to $_SERVER['HTTP_HOST'] would be a more robust solution.
Upvotes: 3