Skip to content

Instantly share code, notes, and snippets.

@bjorn2404
Created May 21, 2015 20:51
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bjorn2404/1d1af23f82c6a3e0dade to your computer and use it in GitHub Desktop.
Save bjorn2404/1d1af23f82c6a3e0dade 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>
@buraksahin59
Copy link

Perfect code, Thank you ✌🏻

@microdesign
Copy link

Thank you man!

@khigashi
Copy link

Thank you!!! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment