Last active
November 29, 2017 08:11
-
-
Save blizzrdof77/388ec4ddee8127f424042184afdac9d6 to your computer and use it in GitHub Desktop.
Load TurdPress uploads from stage/production when files don't exist locally (complex version w/ multiple environments/fallbacks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LOAD UPLOADS FROM STAGE/PRODUCTION | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /wp-content/uploads/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# Rewrite local to stage | |
RewriteCond %{HTTP_HOST} ^example\.dev$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://example.stage.com/wp-content/uploads/$1 [L] | |
RewriteCond %{HTTP_HOST} ^example\.dev$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://example.stage.com/wp-content/uploads/$1 [L] | |
# Rewrite stage to secondary stage | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{HTTP_HOST} ^example\.stage\.com$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://example.stage.com/wp-content/uploads/$1 [L] | |
# Rewrite secondary stage to production | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{HTTP_HOST} ^example\.stage\.com$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://www.example.com/wp-content/uploads/$1 [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment