Created
May 9, 2019 23:03
-
-
Save quinns/e01b3efda7a2ffbc4df5039f18da6773 to your computer and use it in GitHub Desktop.
Boost rules for Drupal 7
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
### BOOST START ### | |
# Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support) | |
RewriteRule .* - [E=boostpath:normal] | |
# Caching for anonymous users | |
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request | |
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR] | |
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR] | |
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR] | |
RewriteCond %{ENV:REDIRECT_STATUS} 200 | |
RewriteRule .* - [S=7] | |
# GZIP | |
RewriteCond %{HTTP:Accept-encoding} !gzip | |
RewriteRule .* - [S=3] | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html,E=no-gzip:1] | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=application/xml,E=no-gzip:1] | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript,E=no-gzip:1] | |
# NORMAL | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html] | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=application/xml] | |
RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json -s | |
RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript] | |
### BOOST END ### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment