Page 1 of 1

Simulating Domains

Posted: Tue Jun 09, 2009 3:42 am
by jack_indigo
I have a server that hosts stuff automatically from /var/www. I copied a directory like domain.com inside /var/www. I then added domain.com into my /etc/hosts for 127.0.0.1 (localhost/loopback). What's the .htaccess trick with Apache so that I can hit my site with: http://domain.com/ and it automatically knows to look in /var/www/domain.com/ (without redirection of the URL)?

Re: Simulating Domains

Posted: Tue Jun 09, 2009 4:01 am
by VladSun
It's called "virtual hosts" - in your case "name based". It's not .htaccess rule.
http://httpd.apache.org/docs/1.3/vhosts/name-based.html