.htaccess, redirect to HTTP_HOST specific folder.
I'm trying to have the server lookup files/images in a different folder, than typed in the address bar.
For example, if somebody types
http://my-domain.com/images/test.jpg
the server should look for the image in:
/images/my-domain.com/test.jpg and not /images/test.jpg as it normally would.
I've managed to get the domain-name into the RewriteRule, but it still isn't working:
RewriteRule ^images/(.*) images/%{HTTP_HOST}/$1 [L]
This WORKS:
RewriteRule ^images/(.*) images/%{HTTP_HOST}/test.jpg [L]
But here the image, test.jpg, is hard-coded which it of course shouldn't be.
Can anybody help? And does it make any sense?
Re: .htaccess, redirect to HTTP_HOST specific folder.
Oh so close. Try the following instead...
Code:
RewriteRule ^images/(.*)$ images/%{HTTP_HOST}/$1 [L]
Re: .htaccess, redirect to HTTP_HOST specific folder.
Well, it does something else now.
But in my error log I now get (I didn't get that before):
Request exceeded the limit of 10 internal redirects due to probable configuration error
Re: .htaccess, redirect to HTTP_HOST specific folder.
Try it without the parenthetical regular expression.
Re: .htaccess, redirect to HTTP_HOST specific folder.
This made the trick:
RewriteCond %{REQUEST_URI} !^/uploads/.*?/.*$