Okay, I have multiple domains on my server. They have vhost conf files. my main domain.. www.example.com has config file such as..

ServerAdmin example@example.net ServerName example.net ServerAlias www.example.net DocumentRoot /var/www/example.net/public_html

I have 2 files for it.. 80 and 443 for SSL

Now the issue is this.. When I type in a browser www.example.com it takes me to root folder of domain instead of site folder root that's in the path.

when I type example.com into the browser it takes me to the correct root. I can not find this issue anywhere or how to solve i've tried everything I can think of.


You might have another VirtualHost that matches the www.example.com and appears before in the configuration. That configuration would be used, instead.

A very common mistake is omitting ServerName in the default (or any) virtualhost. If no ServerName is specified, the server attempts to deduce it from the server's IP address, and this may result in www.example.com, making it unintuitively the first matching virtualhost instead of the one actually having it as a ServerName or in ServerAlias.


need to verify the virtual host configuration for domain example.com.

ServerName example.com

ServerAlias www.example.com

DocumentRoot /var/www/example.com/public_html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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