howkj1/jim-main/gh-pages/.htaccess - Htaccess File

howkj1/jim-main/gh-pages/.htaccess

<IfModule mod_headers.c>
  <FilesMatch ".(htm|html|js|css|xml|gz|jpg|png|json)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>
<files *.js.gz>
  AddType "text/javascript" .gz
  AddEncoding gzip .gz
</files>
<files *.css.gz>
  AddType "text/css" .gz
  AddEncoding gzip .gz
</files>
RewriteEngine on
#Check to see if browser can accept gzip files.
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]
# 480 weeks
<FilesMatch ".(ico|pdf|png|gif|js|css|jpg|gz)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

# 2 DAYS
<FilesMatch ".(json)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch ".(htm|html)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

On Github License

Files

Download PDF of Htaccess file
HTTP_USER_AGENT, REQUEST_FILENAME

Comments

Apache