Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to setup my virtual host to not require WWW. I want it to be subdomain agnostic. How can this be accomplished? Thanks!

Edit: sorry I was not clear. I host multiple sites on the same apache install, each with its own virtual host. I want each one to be accessible with and without www, ie: www-agnostic.

so and are both caught by the same vhost.


share|improve this question
you probably don't need virtual hosts for this if you don't have subdomains. Just set the Listen 80/Listen 443 at the top of the httpd.conf. – Jason Huntley Mar 28 '12 at 19:28
Yeah, if you only want your website not to require www. then just don't type it. – gparent Mar 28 '12 at 19:30
Did you get this working? I saw you wrote a comment about how it didn't work, but looks like you edited or deleted it afterwards. – gparent Mar 28 '12 at 20:40

This should do the trick assuming your DNS records are set straight:

<VirtualHost *>
share|improve this answer
Edited original post. – coergoa Mar 28 '12 at 19:37
It's the same answer, but I'll edit it. Simply add virtualhosts as needed. – gparent Mar 28 '12 at 19:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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