htaccess重写条件/查找文件名中的模式

我想要一个文件夹中的某些图像加水印。 我得到了以下的htaccess块:

RewriteEngine On RewriteCond %{REQUEST_URI} ^/media/image/thumbnail/(.*)([gif|jpe?g|png|bmp])$ RewriteRule ^(.*) /watermark/watermark.php?src=$1 [L] 

不过,我只想为更大的缩略图加水印。 我们的系统中有一个命名约定,它将图像的尺寸添加到文件名中。 一个典型的名字是:

img1_285x255.png

那么我怎样才能改变.htaccess来访问名字以“285×255.png”结尾的文件呢?

So how would I have to change the .htaccess in order to access files whose names end with "285x255.png" for example?

你可以做这样的事情:

 RewriteRule ^(.+?285x255\.png)$ /watermark/watermark.php?src=$1 [L,NC,QSA]