Created
March 7, 2020 01:16
-
-
Save webdevsuperfast/6ee036391e1bc1ecd32973351defefcd to your computer and use it in GitHub Desktop.
WordPress load images from production
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
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# If images not found on development site, load from production | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^wp-content/uploads/[^/]+/.+\.(jpe?g|jpg|png|gif)$ https://example.com/$0 [R=302,L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment