wildcard to rewritre multi domains to www

AMP Admin admin at ampprod.com
Sun Sep 6 18:58:29 MSD 2009

I tried all of the replies and the following worked best.  

server {
        listen                                  80;
        server_name                             www.*;
	... websites configuration below here

server {
        server_name ~^(?!www\.);
        rewrite  ^  http://www.$host$request_uri? permanent;

Thanks everyone! 

On a site note... this is for sites that are on hold (future projects), no
longer needed (for sale), and/or being worked on.  The list of sites is 50+
right now.  Their content is dynamically generated using the $host name.
That why this was so important to me.  Now I can just point new or old
domains to this ip address and that's it until we're ready to work with

More information about the nginx mailing list