tricky 301 redirect

Igor Sysoev igor at sysoev.ru
Wed Nov 10 17:57:40 MSK 2010


On Fri, Nov 05, 2010 at 08:13:40PM -0400, cparfon wrote:

> Hi 
> 
> I'll like to make a 301 redirect like this:
> 
> http://www.my_domain.com/activate/?ac=xyz (xyz is random 36
> alphanumeric
> code)
> 
> TO
> 
> https://another_domain/blah_blah/signup/?ac=test

http {

    map $arg_ac  $ac {
        xyz      https://another_domain/blah_blah/signup/?ac=test
        abc      https://another_domain/blah_blah/signup/?ac=one
        ...
    }

    server {

        location = /activate/ {
            if ($ac) {
                return  301 $ac;
            }
            return 403;
        }


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



More information about the nginx mailing list