Skip to content

Instantly share code, notes, and snippets.

@ebinnion
Forked from bjorn2404/wordpress_remote_images
Created November 9, 2017 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebinnion/28a58d6c0b6a3b4785d40168c1fcf5d8 to your computer and use it in GitHub Desktop.
Save ebinnion/28a58d6c0b6a3b4785d40168c1fcf5d8 to your computer and use it in GitHub Desktop.
WordPress load remote images if they don't exist on the local development server htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.*)$
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads/%1 !-f
RewriteRule ^wp-content/uploads/(.*)$ http://www.remotesite.com/wp-content/uploads/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment