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 have 3 sample domains and would like to converting this .conf to .htaccess so that I don't have to restart my Apache all the time once I've updated my subdomain settings.

NameVirtualHost *:80
<VirtualHost    *:80>
    ServerName www.myserver.com
    DocumentRoot /www
</VirtualHost>
<VirtualHost    *:80>
    ServerName marhazk.myserver.com
    DocumentRoot /www/marhazk.com
</VirtualHost>
<VirtualHost    *:80>
    ServerName perfectworld.myserver.com
    DocumentRoot /www/perfectworld.com
</VirtualHost>

Any idea how?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This is not possible to use virtual host settings in htacess files but you might want to take a look to Apache Mass Virtual Host settings, this allow to have dynamic mapping between servername and documentroot http://httpd.apache.org/docs/2.0/vhosts/mass.html

share|improve this answer

You can't put VirutalHost directives in a .htaccess file. How would Apache even know where to look for the .htaccess file in the first place?

On the Apache help pages, notice that the context is limited to the server config only.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.