The Little Guy Posted March 2, 2012 Share Posted March 2, 2012 I am no Apache expert, but I have been making virtual hosts for every subdomain I make, is there a way for me to only make on virtual host and it will do what ever it is that it does? so, instead of doing this for each subdomian I want, how could I make it dynamic so I only have to create one (is this even possible)? <VirtualHost *:80> ServerAdmin admin@weblyize.com ServerName stats.weblyize.com ServerAlias www.stats.weblyize.com DocumentRoot C:/wamp/www/stats.weblyize.com ErrorLog C:/wamp/bin/apache/Apache2.2.21/logs/stats.weblyize.com/error.log CustomLog C:/wamp/bin/apache/Apache2.2.21/logs/stats.weblyize.com/access.log combined </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/ Share on other sites More sharing options...
requinix Posted March 2, 2012 Share Posted March 2, 2012 Not if they all have different document roots and log files and such. Not that I've done this myself, but I believe the method to do multiple websites is to create a configuration file from each (based on a template) and have Apache reload its settings. It'd be one of the steps in the "create a subdomain" step, alongside making directories and updating databases and whatnot. Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1323181 Share on other sites More sharing options...
The Little Guy Posted March 2, 2012 Author Share Posted March 2, 2012 doesn't Apache have something similar to variables? just found this no idea if its good or not: http://www.cri.ensmp.fr/~coelho/mod_macro/ What about something like this: <VirtualHost *:80> ServerAdmin admin@weblyize.com ServerName %{HTTP_HOST} ServerAlias www.%{HTTP_HOST} DocumentRoot C:/wamp/www/%{HTTP_HOST} ErrorLog C:/wamp/bin/apache/Apache2.2.21/logs/%{HTTP_HOST}/error.log CustomLog C:/wamp/bin/apache/Apache2.2.21/logs/%{HTTP_HOST}/access.log combined </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1323190 Share on other sites More sharing options...
requinix Posted March 2, 2012 Share Posted March 2, 2012 I'll say it now: there could be an extension that'll help do this. Such as mod_macro. Yes, there is some flexibility with configuration, but I'm not sure it extends all the way to directives like ServerName and DocumentRoot. Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1323200 Share on other sites More sharing options...
ttocskcaj Posted March 7, 2012 Share Posted March 7, 2012 This would be quite useful, now that you mention it. But sorry I don't know how to do it. You could try doing a feature request for apache? Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1324690 Share on other sites More sharing options...
trq Posted March 7, 2012 Share Posted March 7, 2012 You could try doing a feature request for apache? Of course, it's already implemented. http://httpd.apache.org/docs/2.0/vhosts/mass.html Quote Link to comment https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1324713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.