Welcome! Log In Create A New Profile

Advanced

Re: URI rewriting based on arguments

B.R.
November 08, 2014 10:44AM
That would be a logical conclusion.

However, rewrite
<http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite>
documentation is unclear about that. It says 'If the specified regular
expression matches a request URI', and nginx has a $request_uri
<http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri>
variable demosntrating what 'request URI' means: what the user input was.
Nowhere it is said that rewrite matches against a normalized URI.
---
*B. R.*

On Sat, Nov 8, 2014 at 6:58 AM, Edho Arief <me@myconan.net> wrote:

> On Sat, Nov 8, 2014 at 11:31 AM, B.R. <reallfqq-nginx@yahoo.fr> wrote:
> > Hello,
> >
> > Trying to rewrite an URI based on an argument, I cannot match it
> otherwise
> > than by using rewrite.
> >
> > The problem is I fail to achieve a working recipe rewriting
> > example.com/watch?v=123456
> > to
> > example.com/watch?vid=123456
> >
> > rewrite ^/watch\?v=(?<video>\d+)$ $scheme://$host$uri?vid=$video?
> > does not seem to work
> >
> > rewrite ^/watch\? $scheme://$host$uri?vid=blah?
> > does not either
> >
> > rewrite ^/watch $scheme://$host$uri?vid=blah?;
> > works, though it explodes internal rewrites (which is not our concern
> here).
> >
>
> afaict, rewrite doesn't handle arguments.
>
> if ($arg_v) {
> rewrite ^ $uri?vid=$arg_v;
> }
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

URI rewriting based on arguments

B.R. November 07, 2014 09:34PM

Re: URI rewriting based on arguments

Edho Arief November 08, 2014 01:00AM

Re: URI rewriting based on arguments

B.R. November 08, 2014 10:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 194
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