supert3d supert3d - 2 months ago 28
Apache Configuration Question

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

Answer

I think you are in need of a RewriteRule rather than RedirectMatch:

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