Skip to content

Instantly share code, notes, and snippets.

@jordanmaslyn
Created December 23, 2015 22:17
Show Gist options
  • Save jordanmaslyn/47e5038e430761ca992c to your computer and use it in GitHub Desktop.
Save jordanmaslyn/47e5038e430761ca992c to your computer and use it in GitHub Desktop.
Drop this in an .htaccess in your Wordpress uploads folder. It will check for the upload on your existing site, and if it doesn't find it there, will look for it on your live site.
# /wp-content/uploads/.htaccess
# Attempt to load files from production if they're not in our local version
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://www.LIVESITEURL.TLD/wp-content/uploads/$1
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment