Anyway to avoid putting in seperate www for ServerAlias in Apache

Lid asked:

I have a server with about 2000 domains on it pointing to same folder.

I put an include file with the domain list into a virtual host entry.

Do I need to make a second include file for etc.. or is there a better way to do this to avoid redundant data and a waste of RAM for apache to load a file twice as large?

I do have access to the dns records if that’s a better option.

My answer:

Apache cannot know to serve the hostname unless you put it in its configuration somehow.

If you don’t intend to serve a site on the other hostname, then you can simply let it go to the default virtual host and get a 403/404, or you can create a new virtual host that does WWW redirection.

But regardless, you have to decide how these requests should be handled, and then tell Apache about it.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.