Welcome! Log In Create A New Profile

Advanced

Re: please help me with follow rewrite rule.

António P. P. Almeida
October 06, 2010 01:50PM
On 6 Out 2010 17h50 WEST, nginx-forum@nginx.us wrote:

> here is the structure:
> /images/thumbnails/
> /watermark
>
> i use follow rewrite rule to add a watermark on my pictures.
>
> rewrite ^/images/(.*)\.jpg /wm/wm.php?$request_filename;
>
> i found it will rewrite with images/*.jpg and
> image/thumbnails/*.jpg, but actually i only wanna rewrite
> images/*.jpg, not subdirectories. then i change it to:
>
> rewrite ^/images/(.[^/])\.jpg
> /watermark/image.php?$request_filename;

You regex is incorrect. Furthermore since you're not doing any
capturing or using alternative patterns drop the group.

rewrite ^/images/[^/]*\.jpg /watermark/image.php?$request_filename;

It matches any file *only* under the images directory ending in .jpg.

--- appa


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

please help me with follow rewrite rule.

digginchina October 06, 2010 12:50PM

Re: please help me with follow rewrite rule.

Maxim Dounin October 06, 2010 01:18PM

Re: please help me with follow rewrite rule.

António P. P. Almeida October 06, 2010 01:50PM

Re: please help me with follow rewrite rule.

digginchina October 25, 2010 03:11AM

Re: please help me with follow rewrite rule.

digginchina October 25, 2010 06:52AM

Re: please help me with follow rewrite rule.

digginchina October 06, 2010 06:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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