rewrite scheme for url redirect

António P. P. Almeida appa at perusio.net
Thu Jan 27 17:27:02 MSK 2011


On 27 Jan 2011 14h17 WET, nginx-forum at nginx.us wrote:


> Because the regexp you posted has curly braces. So, following nginx
> wiki (http://wiki.nginx.org/HttpRewriteModule#rewrite) i tried to
> wrap it into both single and double quotes but with no result:

I overlooked that :(

> location /oldfolder { rewrite
> '^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$'
> http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
> permanent; }
>
> location /oldfolder { rewrite
> "^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$"
> http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
> permanent; }
>
> Nginx doesn't redirect my uri requests, so the problem still
> remains...

I suggest you check the logs and/pr enable the debug flag and trace
Nginx request processing. It will tell what's really going on. The
above regex does capture the patterns you want, so something else must
be creating the problems.

--- appa




More information about the nginx mailing list