#------------------------------------------------------------------------
#  * Luxeritas WordPress Theme - https://thk.kanzae.net/wp/
#  * Copyright (C) 2015 Thought is free.
#
#    Add these lines to your .htaccess to speed boost
#
# Do not overwrite/replace with your .htaccess, but ADD these lines!
#------------------------------------------------------------------------

# Add MIME Type 
<IfModule mime_module>
	AddType text/cache-manifest .appcache
	AddType image/x-icon .ico
	AddType image/svg+xml .svg
	AddType application/x-font-ttf .ttf
	AddType application/x-font-woff .woff
	AddType application/x-font-woff2 .woff2
	AddType application/x-font-opentype .otf
	AddType application/vnd.ms-fontobject .eot
</IfModule>

<IfModule mod_headers.c>
	# For proxy cache (will cache images and fonts)
	<FilesMatch "\.(ico|jpe?g|png|gif|svg|swf|pdf|ttf|woff|woff2|otf|eot)$">
		Header set Cache-Control "max-age=604800, public"
	</FilesMatch>

	# To avoid proxy servers to distibute incorrect contents
	Header append Vary Accept-Encoding env=!dont-vary

	# Security improvement
	Header always append X-Frame-Options SAMEORIGIN
	Header always set X-Content-Type-Options "nosniff"
	Header always set X-XSS-Protection "1; mode=block"
	Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
	Header always set Content-Security-Policy "upgrade-insecure-requests"
	Header always set Referrer-Policy "no-referrer-when-downgrade"
	Header always set Permissions-Policy "geolocation=(), midi=(), sync-xhr=(), microphone=(), camera=(), magnetometer=(), gyroscope=(), payment=(), fullscreen=(self)"

	# Enable Keep-Alive
	#<IfModule mod_env.c>
	#	SetEnv KeepAlive On
	#	SetEnv KeepAliveTimeout 15
	#	SetEnv MaxKeepAliveRequests 100
	#</IfModule>
	#Header unset Connection
	#Header set Connection keep-alive

	# To ignore ETags(Configure entity tags)
	Header unset ETag

	# Browser Cache Setting
	<IfModule mod_expires.c>
		ExpiresActive On

		# Expire cache (Set as 1 sec)
		ExpiresDefault "access plus 1 seconds"

		# For each MIME Type
		ExpiresByType text/css "access plus 1 month"
		ExpiresByType text/js "access plus 1 month"
		ExpiresByType text/javascript "access plus 1 month"
		ExpiresByType image/gif "access plus 1 month"
		ExpiresByType image/jpeg "access plus 1 month"
		ExpiresByType image/png "access plus 1 month"
		ExpiresByType image/webp "access plus 1 month"
		ExpiresByType image/svg+xml "access plus 1 year"
		ExpiresByType font/woff "access plus 1 year"
		ExpiresByType font/woff2 "access plus 1 year"
		ExpiresByType application/x-font-woff "access plus 1 year"
		ExpiresByType application/pdf "access plus 1 month"
		ExpiresByType application/json "access plus 1 month"
		ExpiresByType application/javascript "access plus 1 month"
		ExpiresByType application/x-javascript "access plus 1 month"
		ExpiresByType application/x-shockwave-flash "access plus 1 month"
		ExpiresByType application/font-woff "access plus 1 year"
		ExpiresByType application/x-font-woff "access plus 1 year"
		ExpiresByType application/font-woff2 "access plus 1 year"
		ExpiresByType application/x-font-woff2 "access plus 1 year"
		ExpiresByType application/x-font-ttf "access plus 1 year"
		ExpiresByType application/x-font-opentype "access plus 1 year"
		ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
	</IfModule>
</IfModule>
FileETag None

# Gzip Compresssion
<IfModule mod_deflate.c>
	SetOutputFilter DEFLATE

	# For Browser versions
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch \bMSIE\s(7|8) !no-gzip !gzip-only-text/html

	# To avoid re-compression for post-compressed contents such as images
	SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|ico|eot|woff|woff2)$ no-gzip dont-vary

	AddOutputFilterByType DEFLATE text/plain
	AddOutputFilterByType DEFLATE text/html
	AddOutputFilterByType DEFLATE text/xml
	AddOutputFilterByType DEFLATE text/css
	AddOutputFilterByType DEFLATE text/js
	AddOutputFilterByType DEFLATE image/svg+xml
	AddOutputFilterByType DEFLATE application/json
	AddOutputFilterByType DEFLATE application/xml
	AddOutputFilterByType DEFLATE application/xhtml+xml
	AddOutputFilterByType DEFLATE application/rss+xml
	AddOutputFilterByType DEFLATE application/atom_xml
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE application/x-javascript
	AddOutputFilterByType DEFLATE application/x-httpd-php
	AddOutputFilterByType DEFLATE application/x-font-ttf
	#AddOutputFilterByType DEFLATE application/x-font-woff
	#AddOutputFilterByType DEFLATE application/x-font-woff2
	AddOutputFilterByType DEFLATE application/x-font-opentype
	#AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
</IfModule>
