Welcome! Log In Create A New Profile

Advanced

URI rewriting based on arguments

B.R.
November 07, 2014 09:34PM
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)..

The question mark in the first recipe seems to wreak havoc.

1. Is there any other mean to achieve such a redirection than using
rewrite?
2. How to escape a question mark in a rewrite mask, ince escaping
perl-like does not seem to work?

​Thanks,​
---
*B. R.*
_______________________________________________
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: 153
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