Skip to content

Instantly share code, notes, and snippets.

@annalinneajohansson
Last active November 18, 2019 09:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annalinneajohansson/f1129ef57206eb2e523d to your computer and use it in GitHub Desktop.
Save annalinneajohansson/f1129ef57206eb2e523d to your computer and use it in GitHub Desktop.
# Attempt to load files from production if they're not in our local version. Adapted from: http://stevegrunwell.com/blog/keeping-wordpress-under-version-control-with-git
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^local.site\.com$
RewriteRule ^wp-content/uploads/(.*)$ https://production.site.com/wp-content/uploads/$1 [NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^wp-content/(.*\.(gif|jpg|png)) http://<DOMAIN NAME>/wp-content/$1 [L,R]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment