The module mod_vhost_alias creates dynamically configured virtual hosts, by allowing the IP address and/or the Host: header of the HTTP request to be used as part of the pathname to determine what files to serve. This allows for easy use of a huge number of virtual hosts with similar configurations. In this example test.server1.com will resolve to /var/www/test
vim /etc/httpd/conf/httpd.conf Uncomment: NameVirtualHost *:80 Add: UseCanonicalName Off <VirtualHost *:80> ServerAlias *.server1.com VirtualDocumentRoot /var/www/%-3 <Directory /var/www/%-3> Order allow,deny Allow from all Options Indexes FollowSymLinks MultiViews AllowOverride All </Directory> </VirtualHost> service httpd restart |
Note: if you are running drupal: in your drupal .htaccess, uncomment the line that says # RewriteBase / so it says instead: RewriteBase /