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/