Last active
February 13, 2024 15:00
-
-
Save solepixel/254ccb9919967846fa85 to your computer and use it in GitHub Desktop.
This htaccess snippet (lines 4-12) will pull any missing images from another URL. Helpful when developing locally or on a staging site where media is present on production but is too much to migrate to staging or locally.
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# BEGIN Use uploads directory from Live Site | |
RewriteBase /wp-content/uploads/ | |
RewriteCond %{HTTP_HOST} !^www\.livedomain\.com | |
RewriteCond %{HTTP_HOST} !^livedomain\.com | |
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*) https://livedomain.com/$1 [L,NC] | |
# END Media from Live Site | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment