I am struggling with the last part, writing proper RewriteRule (maybe I also need RewriteCond?).
I have this mapping.txt
:
apple 30/products/apple.png
xerox 38/products/xerox-300.png
dell 3021/products/dell_img.png
...
with it I want to do URL redirects as following:
https://www.domain-a.com/product_img/apple -> https://www.domain-b.com/img/30/products/apple.png
https://www.domain-a.com/product_img/xerox -> https://www.domain-b.com/img/38/products/xerox-300.png
...
in my .htaccess
I have:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteMap redirect_map txt:/home/username/domains/domain-a/public_html/product_img/mapping.txt
RewriteRule * ${redirect_map:$1} // <--- struggling with this line
</IfModule>
How do I write proper RewriteRule for my case? I've tried many options without any luck yet. Secondly, should I have these rules in /public_html/.htaccess
or create a new one in /public_html/product_img/.htaccess
?