Welcome! Log In Create A New Profile

Advanced

Re: please help me with follow rewrite rule.

Maxim Dounin
October 06, 2010 01:18PM
Hello!

On Wed, Oct 06, 2010 at 12:50:29PM -0400, digginchina 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;

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

> my opinion is fit all character except "/" so that i can remove all
> subdirectories from the rewrite rule.
>
> but unfortunately, it doesn't work well, /images/*.jpg can't be rewrited
> too.
>
> is there anybody help me with this case?

Recommended reading:
Jeffrey E.F. Friedl, "Mastering Regular Expressions"

And try pcre manpages, in particular 'man pcrepattern'. Using
pcretest to test things is good idea, too.

Maxim Dounin

_______________________________________________
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: 317
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