Can nginx do this?

lhmwzy lhmwzy at gmail.com
Fri Aug 7 12:52:52 MSD 2009


2009/8/7 Igor Sysoev <is at rambler-co.ru>:
> On Fri, Aug 07, 2009 at 03:10:10PM +0800, lhmwzy wrote:
>

>    server {
>        server_name ~^(.*)\.afen\.com$;
>        rewrite ^ http://www.afen.com/$1$request_uri?;
>    }
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>

should

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

or has error:
      [emerg]: pattern "^" has less captures than referrenced in
substitution "http://www.afen.com/$1$request_uri" in
/usr/local/etc/nginx/nginx.conf:447





More information about the nginx mailing list