Welcome! Log In Create A New Profile

Advanced

Apply URL encoding during rewrite rule

Ed W
February 01, 2012 02:26PM
Hi, I need to do a redirect and pass the old URL to the redirected
destination. How might I achieve this using nginx?

I tried a rewrite rule simply:
rewrite ^/(.*)
$scheme://$server_addr/?redirect_to=$scheme://$host$request_uri redirect;

However, this simply appends the old url verbatim on the end of the
?redirect_to parameter

I tried a few other variables, but I don't see any way to ask Nginx to
url-encode something for me?

Any other thoughts on ways to achieve the desired effect? The
redirected to destination is a web app under my control - we could proxy
the initial request to the web app and have it generate the redirect,
but I was hoping to decouple things

Thanks for any thoughts

Ed W

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Apply URL encoding during rewrite rule

Ed W February 01, 2012 02:26PM

Re: Apply URL encoding during rewrite rule

António P. P. Almeida February 01, 2012 02:40PM

Re: Apply URL encoding during rewrite rule

Ed W February 01, 2012 04:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 162
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready