.htaccess – Moved images to another folder

07/05/2020 | By Dev | Filed in: htaccess.

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]

Comments are closed here.