Cloning a production site to your local development environment is super easy. Often you have it in git, or maybe even as a make file. Anyway, you just grab the code and restore the site from a backup_migrate dump. But maybe you have a KING SIZE files directory that you don’t want (or have the time) to download. Enter Apache rewrite magic!

You can just redirect your local files directory to the external files directory, so that localhost.dev/sites/default/files point to example.com/sites/default/files. To do this, you need apache modules proxy and proxy_http. The rest is just a couple of lines in the virtual host config. Example:

<Directory /your/drupal/sites/default/files>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ http://example.com/sites/default/files/$1 [P]
</Directory>

Voila!