Apache2: VirtualHost doesn’t work

apache-2.2virtualhost

I'm having issues with redirecting a domain name to a specific folder on my server.
I'm reading the istructions from here:

These are my configuration lines:

#This is the default Apache2 configuration lines
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www

#This is what I've added
<VirtualHost *:80>
    DocumentRoot /var/www/astudio/sites/mywebsite
    ServerName www.mywebsite.com
</VirtualHost>

However it doesn't work.. the domain just not forward the user to my website.. is there something else I have to configure ?

Best Answer

Try this (presuming that www.mywebsite.com resolves to the ip address of your web server):

#This is the default Apache2 configuration lines
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/astudio/sites/mywebsite
   ServerName www.mywebsite.com
</VirtualHost>
Related Topic