Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Last active January 1, 2020 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjangl/4c5f0352c44599efc26218ee14eb0e13 to your computer and use it in GitHub Desktop.
Save chrisjangl/4c5f0352c44599efc26218ee14eb0e13 to your computer and use it in GitHub Desktop.
Load images requested on a local/dev (or any)WordPress site from the production (or any other) site. Make sure to add this snipped ABOVE the WordPress rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(wp-content/uploads/\d{4}/\d\d/.*\.jpg)$ https://<your-production-url>.com/$1 [QSA,L]
RewriteRule ^(wp-content/uploads/\d{4}/\d\d/.*\.png)$ https://<your-production-url>.com/$1 [QSA,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment