Skip to content

Instantly share code, notes, and snippets.

@ramonchito2
Last active January 11, 2017 19:03
Show Gist options
  • Save ramonchito2/00da8d09f9c913117673281dc4babe66 to your computer and use it in GitHub Desktop.
Save ramonchito2/00da8d09f9c913117673281dc4babe66 to your computer and use it in GitHub Desktop.
Load Wordpress media files from prod if they don't exist locally via .htaccess
# Load media files from production server if they don't exist locally
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^local\.dev$
RewriteRule ^wp-content/uploads/(.*)$ http://remote.com/wp-content/uploads/$1 [NC,L]
</IfModule>
# Make sure 'local.dev' and 'remote.com' are replaced by your own domains respectively.
# This should be placed above Wordpress' '<IFModule ..>'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment