.htaccess – Moved images to another folder

When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.

Consider the following rule:

RewriteEngine On
RewriteRule ^assets/(.+)\.(png|gif|jpg)$ html/assets/$1.$2 [QSA,L]

Exit mobile version