How can I access the matched variable in the a rule like this one ?
RewriteCond %{HTTP_REFERER} ^http://example\.com/dir[0-9]/?(.*)?$
RewriteRule ^images/(.*)$ other_dir(MATCHED_STRING)/images/$1 [L]
I would like the url : http://example.com/dir1
to redirect all its images to /other_dir1/images/$1
Use the % to access back refernces from a RewriteCond. So in your example:
The
%1will be replaced with what was matched in the RewriteCond in the HTTP referer.