Skip to content

Instantly share code, notes, and snippets.

@sean-e-dietrich
Created July 30, 2021 23:43
Show Gist options
  • Save sean-e-dietrich/00c78963ad66eac310d78fc8c5443c69 to your computer and use it in GitHub Desktop.
Save sean-e-dietrich/00c78963ad66eac310d78fc8c5443c69 to your computer and use it in GitHub Desktop.
Apache File Proxy
<IfModule mod_rewrite.c>
RewriteEngine on
# Force image styles that have local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/sites/([.]*)/files/styles/[^\/]*/public/((.*))$
RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the
# production server.
RewriteCond %{REQUEST_URI} ^/sites/(.*)/files/.*$
RewriteCond %{REQUEST_URI} !^/sites/(.*)/files/(css|advagg-css|js|advagg-js)/.*$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ##DOMAIN##/$1 [QSA,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment