- View
- Edit
- Delete
Situation:
Working with drupal locally might be a little bit annoying with the domain issues it can have. thats why a good option ( working with multiple installations ) is to create different host entries and create a vhost for each entry.
#Register a host in /etc/hosts
function register_host {
echo "127.0.0.1 $1.site" | sudo tee -a /etc/hosts
add_vhost $1 $2 $3 | sudo tee -a /etc/apache2/extra/httpd-vhosts.conf
sudo apachectl restart
}
function add_vhost {
echo "
#$3
<VirtualHost *:80>
ServerName $1.site
DocumentRoot /Users/webalab/$2
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
</VirtualHost>"
}
Usage:
register_host testdomain /www/testdomain
will point testdomain.site to 127.0.0.1 and grab the files from /www/testdomain