wildcard to rewritre multi domains to www
Igor Sysoev
is at rambler-co.ru
Sat Sep 5 18:21:18 MSD 2009
On Sat, Sep 05, 2009 at 08:57:57AM -0500, AMP Admin wrote:
> Hi, I would like to rewrite several domains to from .example.com to
> www.example.com. I think the best way is to use a wild card. Too bad I
> suck at rewrite rules. Haha
>
> Can someone help me make the following work?
>
> if ($host != 'www.*.com') {
> rewrite ^/(.*)$ http://www.*.com/$1 permanent;
> }
server {
server_name ~^((?:domain1|domain2|domain3)\.com)$;
set $name $1;
rewrite ^ http://www.$name$request_uri? permanent;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list