RedirectMatch>正则表达式

时间:2016-09-08 20:37:03

标签: regex apache .htaccess

为什么这不起作用的任何想法?

.htaccess文件中的RedirectMatch规则。

    RedirectMatch "(?:example.com)\/(?:images)\/(.*)(jp?g|bmp|png)" "http://www.example.com/assets/images/public/$1$2"

我觉得它归结为正则表达不正确。

期望的结果: 基本上,如果请求是: http://www.example.com/images/some-logo.jpg 它从这里被拉出来: http://www.example.com/assets/images/public/some-logo.jpg

1 个答案:

答案 0 :(得分:1)

我认为您需要RewriteRule而不是RedirectMatch

RewriteRule ^images/([^/]+)$ /assets/images/public/$1 [L]
相关问题