简体   繁体   中英

RedirectMatch > regex

Any ideas why this isn't working?

RedirectMatch rule in an .htaccess file.

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

我认为您需要一个RewriteRule而不是RedirectMatch

RewriteRule ^images/([^/]+)$ /assets/images/public/$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM