Forum: NGINX redirect question (inception inside)

1527b93d7236f33dbbdfe7d548ae7bef?d=identicon&s=25 Ronald Van Assche (Guest)
on 2014-08-16 10:27
(Received via mailing list)
I want to redirect /us/us/directory/filename to the
/us/directory/filename directory on my Nginx server.

but this

        if ( $request_filename ~ /us/us/.+ ) {
                rewrite ^(.*) http://mysiteurlt/us/$1 permanent;
        }

wont work.

How can i redirect or rewrite such url  ?
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-08-16 10:44
(Received via mailing list)
Shouldn't the /us/ be removed in the rewrite? what does the logfile say
where it is trying to locate to?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,252606,252607#msg-252607
B459184a1a76aadb382353b20988ccfa?d=identicon&s=25 Edho Arief (Guest)
on 2014-08-16 10:53
(Received via mailing list)
On Sat, Aug 16, 2014 at 5:27 PM, Ronald Van Assche <rva@onvaoo.com>
wrote:
> How can i redirect or rewrite such url  ?
location ^~ /us/us/ {
  rewrite ^/us(/us/.*) $1 permanent;
}
1527b93d7236f33dbbdfe7d548ae7bef?d=identicon&s=25 Ronald Van Assche (Guest)
on 2014-08-16 11:23
(Received via mailing list)
NICE : it works

more complicated one :

/ue//ue/data/filename => /ue/data/filenam
there is 2 / in the URL.

 location ^~ /ue//ue/ {
                rewrite ^/ue(/ue/.*) $1 permanent;
        }

does not work :o(



Le 16 aot 2014  10:52, Edho Arief <me@myconan.net> a crit :
B459184a1a76aadb382353b20988ccfa?d=identicon&s=25 Edho Arief (Guest)
on 2014-08-16 12:08
(Received via mailing list)
On Aug 16, 2014 6:22 PM, "Ronald Van Assche" <rva@onvaoo.com> wrote:
>         }
>
> does not work :o(
>
>

try reading the documentation: http://nginx.org/r/location
1527b93d7236f33dbbdfe7d548ae7bef?d=identicon&s=25 Ronald Van Assche (Guest)
on 2014-08-16 12:27
(Received via mailing list)
YEP thank you :
> The matching is performed against a normalized URI, after decoding the text
encoded in the %XX form, resolving references to relative path components . and
.., and possible compression of two or more adjacent slashes into a single 
slash.

so i do not have to put // in the location , and it works

   location ^~ /ue/ue/ {
                rewrite ^/ue(/ue/.*) $1 permanent;
        }


Thank you all people here.

--
Ronald,
Paris.


Le 16 aot 2014  12:07, Edho Arief <me@myconan.net> a crit :
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.