URI rewriting based on arguments

B.R. reallfqq-nginx at yahoo.fr
Sat Nov 8 02:31:59 UTC 2014


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

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
   2. How to escape a question mark in a rewrite mask, ince escaping
   perl-like does not seem to work?

*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141108/760280f8/attachment.html>

More information about the nginx mailing list