Hi I am looking for some help with properly using a rewrite rule for mod_rewrite with my application. I have multiple domains pointing to the same file structure on my server since I am using a custom php script to display the correct content per domain.
Now I want to be able to map part of file structure that does not point to a script so I can have files delivered via a shorter easier to access file path htaccess
So I want to use domain.com/file/example.jpg
instead of domain.com/file/specific_folder_for_this_domain/example.jpg
I have tried this so far with no luck
RewriteRule ^file/(.*)$ file/%{HTTP_HOST}/$1 [L]
When I looked the mod_rewrite log on my test server I found it was looping through the %{HTTP_HOST} variable for some reason and internal paths to files came out looking something like
/home/www/domain.com/file/domain.com/domain.com/domain.com/domain.com/example.jpg
which obviously doesn't exist anywhere on my server so there are 500 errors being logged. Does anyone know how to properly set up this sort of domain mapping?