Last active
February 11, 2019 22:59
-
-
Save hellerbenjamin/0530a5a116108e7204a47d430d62859b to your computer and use it in GitHub Desktop.
htaccess caching
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTPS} =on | |
RewriteCond %{HTTP_HOST} ^benjaminheller.net | |
# Start WPFC Exclude | |
# End WPFC Exclude | |
# Start_WPFC_Exclude_Admin_Cookie | |
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=benheller | |
# End_WPFC_Exclude_Admin_Cookie | |
RewriteCond %{HTTP_HOST} ^benjaminheller.net | |
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot) | |
RewriteCond %{REQUEST_METHOD} !POST | |
RewriteCond %{REQUEST_URI} !(\/){2}$ | |
RewriteCond %{REQUEST_URI} \/$ | |
RewriteCond %{QUERY_STRING} !.+ | |
RewriteCond %{HTTP:Cookie} !wordpress_logged_in | |
RewriteCond %{HTTP:Cookie} !comment_author_ | |
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session | |
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil | |
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] | |
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or] | |
RewriteCond /home/wwwbenjaminhelle/public_html/wp-content/cache/all/$1/index.html -f | |
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L] | |
</IfModule> | |
<FilesMatch "index\.(html|htm)$"> | |
AddDefaultCharset UTF-8 | |
<ifModule mod_headers.c> | |
FileETag None | |
Header unset ETag | |
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" | |
Header set Pragma "no-cache" | |
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT" | |
</ifModule> | |
</FilesMatch> | |
# END WpFastestCache | |
# BEGIN GzipWpFastestCache | |
<IfModule mod_deflate.c> | |
AddType x-font/woff .woff | |
AddType x-font/ttf .ttf | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/x-font-ttf | |
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf | |
</IfModule> | |
# END GzipWpFastestCache | |
# BEGIN LBCWpFastestCache | |
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$"> | |
<IfModule mod_expires.c> | |
AddType application/font-woff2 .woff2 | |
ExpiresActive On | |
ExpiresDefault A0 | |
ExpiresByType image/webp A2592000 | |
ExpiresByType image/gif A2592000 | |
ExpiresByType image/png A2592000 | |
ExpiresByType image/jpg A2592000 | |
ExpiresByType image/jpeg A2592000 | |
ExpiresByType image/ico A2592000 | |
ExpiresByType image/svg+xml A2592000 | |
ExpiresByType text/css A2592000 | |
ExpiresByType text/javascript A2592000 | |
ExpiresByType application/javascript A2592000 | |
ExpiresByType application/x-javascript A2592000 | |
ExpiresByType application/font-woff2 A2592000 | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header set Expires "max-age=2592000, public" | |
Header unset ETag | |
Header set Connection keep-alive | |
FileETag None | |
</IfModule> | |
</FilesMatch> | |
# END LBCWpFastestCache | |
## EXPIRES CACHING ## | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access plus 1 year" | |
ExpiresByType image/jpeg "access plus 1 year" | |
ExpiresByType image/gif "access plus 1 year" | |
ExpiresByType image/png "access plus 1 year" | |
ExpiresByType text/css "access plus 1 month" | |
ExpiresByType application/pdf "access plus 1 month" | |
ExpiresByType text/x-javascript "access plus 1 month" | |
ExpiresByType application/x-shockwave-flash "access plus 1 month" | |
ExpiresByType image/x-icon "access plus 1 year" | |
ExpiresDefault "access plus 2 days" | |
</IfModule> | |
## EXPIRES CACHING ## | |
## GZIP Compression ## | |
<ifModule mod_gzip.c> | |
mod_gzip_on Yes | |
mod_gzip_dechunk Yes | |
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ | |
mod_gzip_item_include handler ^cgi-script$ | |
mod_gzip_item_include mime ^text/.* | |
mod_gzip_item_include mime ^application/x-javascript.* | |
mod_gzip_item_exclude mime ^image/.* | |
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
</ifModule> | |
## GZIP Compression ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment