NginxHttpMapModule

Igor Sysoev is at rambler-co.ru
Fri Oct 16 19:05:01 MSD 2009


On Fri, Oct 16, 2009 at 10:54:31AM -0400, Goldcap wrote:

> To follow up, it's really simple. You don't need the Map module, just a text file with rewrite directives, and the include directive.
> 
> Doh! Not sure why I went the confusing route...
> 
> location / {
>     
>     include /path/to/rewrite_rules_x.txt;
> 
> +++++++++++++++++++++++++++++++
> 
> cat /path/to/rewrite_rules_x.txt
> 
> rewrite	/aaa /someotherpage;
> rewrite      /bbb  http://forum.nginx.org;
> ...

No, it's better to use this configuration:

map $uri $new {
  default        "";
    
  /aa            http://aa.domain.com/;
  /bb            http://bb.domain.com/;
  /john          http://my.domain.com/users/john/;
}

server {

    if ($new) {
        rewrite  ^  $new;
    }

    ...


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





More information about the nginx mailing list