Skip to content

Instantly share code, notes, and snippets.

@Horttcore
Forked from stevegrunwell/.htaccess
Last active June 26, 2020 09:52
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 Horttcore/c0a255921754a572c0ee53388849ef1a to your computer and use it in GitHub Desktop.
Save Horttcore/c0a255921754a572c0ee53388849ef1a to your computer and use it in GitHub Desktop.
Load production WordPress uploads in a local version of the site by putting this in a new Htaccess file in /wp-content/uploads/
# Attempt to load files from production if they're not in our local version (replace {SITE URL} with your production server)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteRule ^(.*)$ https://{SITE URL}/$1 [QSA,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment