# BEGIN WP Roids - DO NOT REMOVE THIS LINE
# Expires headers for older browsers
ExpiresActive On
ExpiresDefault "access plus 1 year"
ExpiresActive On
ExpiresDefault "access plus 2 days"
ExpiresActive On
ExpiresDefault "access plus 5 minutes"
# Headers for newer browsers
Header unset ETag
FileETag None
Header set Connection keep-alive
Header append Vary: Accept-Encoding
# 1 year
Header set Cache-Control "max-age=31449600, public"
# 2 DAYS
Header set Cache-Control "max-age=172800, public, must-revalidate"
# 1 HOUR
Header set Cache-Control "max-age=300, must-revalidate"
# Enable GZIP compression
AddOutputFilterByType DEFLATE application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf font/woff font/woff2 image/svg+xml image/x-icon text/css text/html text/javascript text/plain text/xml
# Remove GZIP browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
# Prevent hotlinking of images
RewriteEngine On
RewriteBase [[WP_ROIDS_REWRITE_BASE]]/
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?[[DOMAIN_NAME]] [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
# Serve cache CSS and JS as PHP
RewriteEngine On
RewriteBase [[WP_ROIDS_REWRITE_BASE]]/
RewriteRule ^([[WP_ROIDS_ASSETS_CACHE]].*)\.(css|js) $1\.php [L]
# serve cached HTML file
RewriteEngine On
RewriteBase [[WP_ROIDS_REWRITE_BASE]]/
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/[[WP_ROIDS_FULL_POSTS_CACHE]]/$1/index.html -f [or]
RewriteCond [[WP_ROIDS_ALT_FULL_POSTS_CACHE]]/$1/index.html -f
RewriteRule ^(.*) "[[WP_ROIDS_POSTS_CACHE]]/$1/index.html" [L]
# END WP Roids - DO NOT REMOVE THIS LINE