Created
April 11, 2015 16:39
-
-
Save bryanhirsch/aeed6e26fc792903d38d to your computer and use it in GitHub Desktop.
Serve files from prod if not found locally
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
# Serve files from prod if not available locally per: | |
# https://docs.acquia.com/articles/serving-files-production-development-environments | |
# | |
# If the request is to the files directory | |
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$ | |
# If we are not on prod | |
RewriteCond %{ENV:AH_SITE_ENVIRONMENT} !^prod | |
# If we are not on stage | |
RewriteCond %{ENV:AH_SITE_ENVIRONMENT} !^test | |
# If the file or directory is not found | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# Then redirect the request to the production server | |
RewriteRule ^sites/default/files/(.*)$ http://example.com/sites/default/files/$1 [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment