Skip to content

Instantly share code, notes, and snippets.

@luiseduardobraschi
Last active March 11, 2023 09:58
Show Gist options
  • Save luiseduardobraschi/f3f8c95183510a0308df2f98117662c4 to your computer and use it in GitHub Desktop.
Save luiseduardobraschi/f3f8c95183510a0308df2f98117662c4 to your computer and use it in GitHub Desktop.
.htaccess - Load image from WooCommerce (WordPress, actually) production site if image not found in test env.
# You must place it above the "# BEGIN WordPress" comment.
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteCond %{REQUEST_FILENAME} !-f
# Just change the URL to your liking.
RewriteRule ^(.*)$ https://www.production-site.com/wp-content/uploads/$1 [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment