Last active
January 11, 2017 19:03
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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