I am hosting multiple websites on an instance of OS X Server 4.0 with an issue. I have a default personal site that is available on the normal domain and the www subdomain. I tried to configure other sites to have that similar result also. However, I am running into a problem. My virtual hosts (other sites) have the www subdomain configured in the DNS records. I configured my Virtual Hosts in OS X Server with 0 additional domains, redirects, or aliases. All other settings are also left default.

The DNS on OS X Server is configured correctly as well. When I try to access http://example.com/ it sends me to the Virtual Host correctly. However, when I do http://www.example.com/ it sends me to the Server Default website, which is my personal site. The only way I can fix this is to add another website using the www.example.com into the list.

Is there another way to fix this instead of adding another site to the list?


Add www.example.com as a ServerAlias to the VirtualHost you want it to use.

| improve this answer | |
  • Thank you so much! That was the answer I was looking for! Is there a built in setting on OS X Server for that option, instead of directly editing Apache config files? – Felix Jen Mar 25 '15 at 5:17

Edit httpd.conf to read;

<VirtualHost *:80(443?)>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /your/doc/root/

Another little nifty trick for ServerAlias that i like is;

ServerAlias *.example.com

(gibberish.example.com@, will still be go to example.com

| improve this answer | |
  • VirtualHostX (Source)@dave-delong – Snow Mar 25 '15 at 5:22

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.