Skip to content

Instantly share code, notes, and snippets.

@daveh
Created May 1, 2021 18:40
Show Gist options
  • Save daveh/8af6a5cd04a8817cdf427878d797d19e to your computer and use it in GitHub Desktop.
Save daveh/8af6a5cd04a8817cdf427878d797d19e to your computer and use it in GitHub Desktop.
How to set up a virtual host in Apache (WAMP, MAMP, XAMPP) (code to accompany https://youtu.be/kRfo5OPUC2M)
<VirtualHost *:80>
DocumentRoot "/www/project1"
ServerName site1.localhost
<Directory "/www/project1">
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/project2"
ServerName site2.localhost
<Directory "/www/project2">
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/path/to/original/web/root"
ServerName localhost
</VirtualHost>
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment