Uploads by proxy – 302 redirect instead of force download to local directory Blog
I stumbled upon http://wordpress.org/plugins/uploads-by-proxy/ a great plugin to fetch remote uploads from your live server when using a staging/dev/local server.
However .. it will fetch all files to your development uploads dir. This may be not suitable for everyone as it needs storage.
The default year 2017 version will also do a host/ip lookup, this patch/version will bypass that as it is not needed anymore.
Version 1.1.2 (year 2017) instructions
DIY
Download (or clone) this repo: https://github.com/ramonfincken/uploads-by-proxy/tree/feature/redirect_instead_of_download
DIY
Define the following in your wp-config.php to 302 to the source instead of downloading the uploads.
define('UBP_REDIRECT', true);
Year 2013 instructions
Here is a "patch" to allow a 302 (temp redirect) to the source image.
OPEN
class-404-template.php
FIND
$url = 'http://' . $ip . $this->get_remote_path();
AFTER, ADD
// Redirect to original url? // Ramon Fincken, MijnPress.nl if(defined('UBP_REDIRECT') && UBP_REDIRECT == TRUE) { $redirect_url = UBP_SITEURL.$this->get_remote_path(); wp_redirect( $redirect_url, 302 ); exit; } // Falltrough to download file to local storage
DIY
Define the following in your wp-config.php to 302 to the source instead of downloading the uploads.
define('UBP_REDIRECT', true);