Can nginx do this?

Igor Sysoev is at rambler-co.ru
Fri Aug 7 12:21:11 MSD 2009


On Fri, Aug 07, 2009 at 03:10:10PM +0800, lhmwzy wrote:

>         if ($http_host ~* "^((?!www).*)\.afen\.com$") {
>                 set $name $1;
>                 rewrite ^ http://www.afen.com/$name$uri;
> }
> 
> this can works.

    server {
        server_name  www.afen.com;
        ...
    }

    server {
        server_name ~^(.*)\.afen\.com$;
        rewrite ^ http://www.afen.com/$1$request_uri?;
    }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list