Forum Moderators: phranque

Message Too Old, No Replies

character limit rule

         

jojy

1:25 am on Jul 28, 2009 (gmt 0)

10+ Year Member



Hello,
I am trying to rewrite image urls some images contains utf-8 characters. My rule fails when an utf-8 character comes or dot

RewriteRule ^image/([0-9]+)/([a-zA-Z0-9_-]+).([a-zA-Z]+) previews/image/$1/$2.$3

i tried (.*) but this does not help

an example where this rule would fail will be image-n.10.jpg

can any one help me with this?

jdMorgan

12:44 pm on Jul 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> an example where this rule would fail will be image-n.10.jpg

If you need assistance with a regular-expressions pattern, please provide the whole URL-path, starting with "/image/", and tell us where this .htaccess file is located.

Thanks,
Jim

jojy

12:54 pm on Jul 28, 2009 (gmt 0)

10+ Year Member



url is http://example.com/image/10/image-n.10.jpg

jdMorgan

3:44 pm on Jul 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> url is http://example.com/image/10/image-n.10.jpg

Allowing the second group to match a period, along with escaping the hyphen (simply to make this more robust across Apache/mod_rewrite/regex-library versions), should fix your problem:


RewriteRule ^image/([0-9]+)/([a-zA-Z0-[b]9._\-][/b]+).([a-zA-Z]+)$ previews/image/$1/$2.$3 [L]

Jim