Welcome! Log In Create A New Profile

Advanced

rewrite rule failing with unicode urls on nginx with pcre 8.3

March 20, 2012 12:06PM
First post on the list, so please be gentle :)

I asked this question on stackoverflow, but wasn't getting any love there, and then realised I should go to the source!

I managed to get nginx (1.0.14) compiled with the latest PCRE (8.30), changed the rewrite rule to use UTF8, but it still fails in some cases with unicode characters.

My rewrite rule is

location / {
try_files $uri $uri/ /index.php;
rewrite "(*UTF8)^/imgthumb/(.*)$" /timthumb.php?$1 last;
}

This works fine with images without unicode, but fails when the filename contains unicode characters.

so `/imgthumb/src=/wp-content/uploads/8姉妹の古いマトリョーシカ.jpg&h=121&w=137&zc=1` **fails**

but `/imgthumb/src=/wp-content/uploads/MOD0005.jpg&h=121&w=137&zc=1` **works** fine.

On Apache using .htaccess rewrite rule, it works with both

`RewriteRule ^/imgthumb/(.*)$ /timthumb.php?$1 [L]`

I noticed that the problem seems to stem from the fact that the PHP script gets only one parameter (src) into the `$_GET` array with nginx, but with apache rewrite it's broken down to different parameters...

Is my nginx rewrite rule wrong? Is there a way to make this work?
Subject Author Posted

rewrite rule failing with unicode urls on nginx with pcre 8.3

yoavaner March 20, 2012 12:06PM

Re: rewrite rule failing with unicode urls on nginx with pcre 8.3

Maxim Dounin March 21, 2012 06:42AM

Re: rewrite rule failing with unicode urls on nginx with pcre 8.3

yoavaner March 21, 2012 06:56AM

Re: rewrite rule failing with unicode urls on nginx with pcre 8.3

Valentin V. Bartenev March 21, 2012 07:32AM

Re: rewrite rule failing with unicode urls on nginx with pcre 8.3

yoavaner March 21, 2012 05:39PM

Re: rewrite rule failing with unicode urls on nginx with pcre 8.3

yoavaner March 21, 2012 06:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready