Skip to content

REWRITE_MATCH_PATTERN / REWRITE_SUBSTITUTION Feature #557

Closed Answered by simonkrol
espietrobom asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @espietrobom,

You're pretty close with your solutions. In the first solution, we aren't hitting the match since the CloudFront URL isn't included when testing the match. In the second solution, it doesn't look like you're capturing any match groups, so rebuilding the path in the substitutions has nothing to build from.

For this particular problem, I had success with the following values:

REWRITE_MATCH_PATTER: /^(.+\.jpg)$/gm
REWRITE_SUBSTITUTION: /200x200/filters:format(webp)/$1

This will match any path that ends in .jpg and will append that matched value to /200x200/filters:format(webp)/

Let me know if you run into any issues,
Simon

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jgrims91
Comment options

@simonkrol
Comment options

Answer selected by simonkrol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants