We are running multiple domains through the same code and we want to save their images in their respective folders. Here’s what we are doing.
/images/www.domain1.com/logo.jpg
/images/www.domain2.com/logo.jpg
now, what I want to know is, is this possible in htaccess that we rewrite the urls without user suspecting anything. This is what I want that
<img src="/images/logo.jpg" />
should internally become through htaccess
RewriteRule ^images/(.*)$ /images/{HTTP_HOST}/$1 [L,R=301]
But my question is,
- The above redirect continually loops
- Can I achieve the img effect without user or admin suspecting anything?
Sincerely,
Khuram
You definitely should not use
Rflag if you don’t want to change URL in browser. However even withoutRflag your RewriteRule will loop infinitely and you will eventually getinternal server error. Use RewriteRule like this:Which is using a special internal variable called
{ENV:REDIRECT_STATUS}that is set to 200 once RewriteRule rule is applied successfully.