Welcome! Log In Create A New Profile

Advanced

Re: NginxHttpMapModule

October 16, 2009 11:10AM
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/
Subject Author Posted

NginxHttpMapModule

Goldcap October 15, 2009 05:34PM

Re: NginxHttpMapModule

Goldcap October 16, 2009 10:54AM

Re: NginxHttpMapModule

Igor Sysoev October 16, 2009 11:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 185
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready