Redirect URLs with query string by RewriteRule

Viewed 27

I am trying to redirect /video/{x1}?width={x2}&height={x3} to /proxy/file/{xf}{x1}?{x1}?width={x2]&height={x3} And I want {xf} to be anything For example: https://another.domain/ and {x1} to support folder and file paths together: /somedir/somefile.png

So a complete example of what I want:

https://example.com/video/somedir/somefile.png?width=123&height=321 to https://example.com/proxy/file/somedir/somefile.png?https://another.domain/somedir/somefile.png?width=123&height=321

This is the code I tested but it didn't work :

# RewriteCond %{QUERY_STRING} ^?width=([0-9]*)&height=([0-9]*)
# RewriteRule ^(.*)$ /proxy/file/$1?https://somedomain/$1$2 [NC,L]
0 Answers
Related