For small number of virtual hosts (vhosts) we can use the “VirtualServer” directive in apache web server. Unfortunately when we have high number of vhosts (hundreds), it gets very complicated to maintain such configuration. The reasons are:

  • it is complicated to add and remove virtual hosts (either to a single conf file or in multiple files inside vhosts.d directory);
  • You must restart the server every time a new virtual host is added/removed;
  • Each virtual host eats usually 2 file handlers (access_log and error_log).

Then mod_rewrite is the right way to follow. mod_rewrite is more complicated as traditional VirtualServer configuration but if you master it, it provides seamless possibilities.


Mass Apache Virtual Hosting using mod_rewrite

Leave a Reply

Your email address will not be published. Required fields are marked *