Jump to content

Dynamic Subdomians


Recommended Posts

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 [email protected]
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>

Link to comment
https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1323181
Share on other sites

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 [email protected]
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>

Link to comment
https://forums.phpfreaks.com/topic/258126-dynamic-subdomians/#findComment-1323190
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.