Aug 22nd, 2013
Here's how to use Apache's rewrite rules to serve files from a remote server. This comes in handy when you have a large /sites/*/files directory. There are modules that can do this (Stage File Proxy) and probably a million other solutions but this one is simple and efficient.
Taken from:http://www.lullabot.com/blog/article/using-remote-image-files-when-you-develop-locally
<IfModule mod_rewrite.c> RewriteEngine on # Force image styles that have local files that exist to be generated. RewriteCond %{REQUEST_URI} ^/sites/([^\/])/files/styles/[^\/]/public/((.))$ RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f RewriteRule ^(.)$ $1 [QSA,L] # Otherwise, send anything else that's in the files directory to the # production server. RewriteCond %{REQUEST_URI} ^/sites/[^\/]/files/.$ RewriteCond %{REQUEST_URI} !^/sites/[^\/]/files/css/.$ RewriteCond %{REQUEST_URI} !^/sites/[^\/]/files/js/.$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ http://www.example.com/$1 [QSA,L] </IfModule>