Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm currently trying to configure Apache vhost configuration and was hoping to be able to use mod_vhost_alias for everything.

Instead of setting up a configuration for each website I wanted to make it dynamic.

So far I have:

VirtualDocumentRoot /home/%-2.0.%-1.0/www

Which works fairly well, but I would like to be able to allow sub-domains so i tried the following:

VirtualDocumentRoot /home/%-2.0.%-1.0/www/%-3.0

But I don't want the DocumentRoot to be /home/example.com/www/www

Is there a way to achieve this? If not, would my best option to use mod_rewrite for subdomains?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.