[英]RedirectMatch > regex
Any ideas why this isn't working? 任何想法为什么这不起作用?
RedirectMatch rule in an .htaccess file. .htaccess文件中的RedirectMatch规则。
RedirectMatch "(?:example.com)\/(?:images)\/(.*)(jp?g|bmp|png)" "http://www.example.com/assets/images/public/$1$2"
I've a feeling it boils down to the regex not being correct. 我觉得它归结为正则表达式不正确。
Desired outcome: Basically if a request is made for: http://www.example.com/images/some-logo.jpg it get's pulled from here: http://www.example.com/assets/images/public/some-logo.jpg 期望的结果:基本上,如果对以下网址提出了要求: http : //www.example.com/images/some-logo.jpg从此处获取: http : //www.example.com/assets/images/public/ some-logo.jpg
我认为您需要一个RewriteRule
而不是RedirectMatch
:
RewriteRule ^images/([^/]+)$ /assets/images/public/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.