.htaccess重写正则表达式不起作用的规则,返回404


.htaccess rewrite rule with regex not working, returns 404

我试图用timthumb库调整图像的大小
我可以通过以下URL 直接使用它

http://localhost/study/server/resize/thumb.php?src=http://localhost/study/server/product/1/1/orig-1.jpg&w=160&h=130

而且效果很好。

但是当我像这个一样重写我的url时

http://localhost/study/server/resize/160x130/r/product/1/1/orig-1.jpg

并添加

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(resize) [NC]
    RewriteRule ^resize/(.*)x(.*)/r/(.*) resize/thumb.php?src=http://localhost/study/server/$3&h=$2&w=$1&c=1
</IfModule>

不幸的是,该规则返回404错误

使用此RewriteRule

RewriteRule ^study/server/resize/([0-9]+)x([0-9]+)/r/product/([0-9]+)/([0-9]+)/(.*)$ 
/study/server/resize/thumb.php?src=/study/server/product/$3/$4/$5&w=$1&h=$2 [L]

组1匹配宽度、零位或多位数字
第2组匹配高度、零位数或更多位数
第3组匹配/product/后的第一个数字,一个数字,您可以根据需要进行修改
第4组匹配/product/后的第二个数字,一个数字,您可以根据需要进行修改
组5与文件名匹配

此条件

RewriteCond %{REQUEST_URI} !^/(resize) [NC]

不需要