Click to See Complete Forum and Search --> : Apache vhosts.conf problem?


dt23
03-31-2005, 10:43 PM
Hello,

When someone types www.mysite.com, they're directed to the appropriate website.

However, when they type: mysite.com (without the www), they're directed to a different website on my server.

Is this an Apache configuration issue or a DNS configuration issue?

In my Vhosts.conf file I have:

ServerName www.mysite.com

Is there a way to specify that mysite.com (without www) should be redirected to mysite as well?

TIA,
dt23

j79zlr
04-01-2005, 04:06 AM
Along as your DNS accepts wildcards, add this line:

ServerAlias mysite.com

thaddaeus
04-01-2005, 04:35 AM
Actually the www would be wildcarded, not the absence of the www, which means you just need to add mysite.com to the vhost file, or just change the default server to pint to the dir you want as the default, ie if someone types in crap.mysite.com it will bring up the same site you'd see at mysite.com. default path is probably /var/www/html, any subdomains, or sub-subdomains need to be either aliased in the vhost file or given their own root_path, I suggest reading the apache man pages and manual