supert3d
supert3d

Reputation: 55

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

Upvotes: 0

Views: 117

Answers (1)

revo
revo

Reputation: 48711

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

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

Upvotes: 1

Related Questions