iSC-Host/ - Htaccess File


# ----------------------------------------------------------------------
# .htaccess
# A .htaccess file (hypertext access) is the
# configuration file that allows for web server configuration.
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# ERROR documents
# ----------------------------------------------------------------------
ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html

# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------

# JavaScript
AddType  application/javascript                js jsonp
AddType  application/json                      json

# Audio
AddType  audio/ogg                        oga ogg
AddType  audio/mp4                        m4a f4a f4b

# Video
AddType  video/ogg                            ogv
AddType  video/mp4                            mp4 m4v f4v f4p
AddType  video/webm                          webm
AddType  video/x-flv                          flv

AddType  image/svg+xml                              svg svgz
AddEncoding  gzip                            svgz

# Webfonts
AddType application/               eot
AddType application/x-font-ttf                    ttf ttc
AddType font/opentype                        otf
AddType application/x-font-woff               woff

# Assorted types
AddType  image/x-icon                         ico
AddType  image/webp                        webp
AddType  text/cache-manifest                      appcache manifest
AddType  text/x-component                      htc
AddType  application/xml                        rss atom xml rdf
AddType  application/x-chrome-extension              crx
AddType  application/x-opera-extension              oex
AddType  application/x-xpinstall                    xpi
AddType  application/octet-stream                  safariextz
AddType  application/x-web-app-manifest+json      webapp
AddType  text/x-vcard                        vcf
AddType  application/x-shockwave-flash              swf
AddType  text/vtt                        vtt

# --------------------------------------------------------------------------------------
# Compression:
# --------------------------------------------------------------------------------------
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/atom+xml
  AddOutputFilterByType DEFLATE application/json
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/x-component
  AddOutputFilterByType DEFLATE text/xml
  # The following MIME types are in the process of registration
  AddOutputFilterByType DEFLATE application/xslt+xml
  AddOutputFilterByType DEFLATE image/svg+xml
  # The following MIME types are NOT registered
  AddOutputFilterByType DEFLATE application/mathml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  # JavaScript has various MIME types
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE text/ecmascript
  AddOutputFilterByType DEFLATE text/javascript

  # .ico files and other compressible images
  AddOutputFilterByType DEFLATE image/
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE image/bmp
  AddOutputFilterByType DEFLATE image/tiff
  AddOutputFilterByType DEFLATE application/pdf

  # compressible fonts (.woff is already compressed)
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/

# ----------------------------------------------------------------------
# Enabling filename rewriting (file.XXX.ext) if URL rewriting is enabled
# Otherwise URLs will use query strings (file.ext?v=XXX)
# More proxies cache assets if there is no query string
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
  RewriteEngine On

  # Setting up an environment variable so your code can detect if mod_rewrite rules are executable
  # in this folder and you can use file.123.jpg or you need to fall back to file.jpg?123
  RewriteRule .          -  [E=URLVERSIONREWRITE:YES]

  # Rewrites a version in file.123.jpg as well as timestamped version file.123_m_12345123512354.jpg
  # to original file.jpg so you can use it instead of file.jpg?123 which isn't cached in some proxies.
  RewriteCond %{REQUEST_FILENAME}      !-f
  RewriteRule ^(.*).(d+)(_m_d+)?.([^.]+)$  $1.$4  [L,QSA]

  # Rewrites a version in file.ac123fe.jpg to original file.jpg
  # so you can use it instead of file.jpg?123 which isn't cached in some proxies.
  # Used for hash-based URLs where having a timestamp is not necessary.
  RewriteCond %{REQUEST_FILENAME}      !-f
  RewriteRule ^(.*).([a-zd]+).([^.]+)$  $1.$3  [L,QSA]

# -------------------------------------------------------------------------------------------------
# Browser Caching:
# Google recommends specifying the following for all cacheable resources:
#    1. Expires or Cache-Control max-age
#   Set Expires to a minimum of one month, and preferably up to one year, in the future. (We
#   prefer Expires over Cache-Control: max-age because it is is more widely supported.) Do not
#   set it to more than one year in the future, as that violates the RFC guidelines.
#    2. Last-Modified or ETag
#   Set the Last-Modified date to the last time the resource was changed. If the Last-Modified
#  date is sufficiently far enough in the past, chances are the browser won't refetch it. 
# Per Google: "it is redundant to specify both Expires and Cache-Control: max-age, or to specify
# both Last-Modified and ETag."
# --------------------------------------------------------------------------------------------------
<IfModule mod_expires.c>
  ExpiresActive On

  ExpiresByType application/json      "access plus 1 year"
  ExpiresByType application/pdf      "access plus 1 year"
  ExpiresByType application/x-shockwave-flash  "access plus 1 year"
  ExpiresByType image/bmp       "access plus 1 year"
  ExpiresByType image/gif       "access plus 1 year"
  ExpiresByType image/jpeg       "access plus 1 year"
  ExpiresByType image/png       "access plus 1 year"
  ExpiresByType image/svg+xml       "access plus 1 year"
  ExpiresByType image/tiff       "access plus 1 year"
  ExpiresByType image/     "access plus 1 year"
    ExpiresByType image/x-icon      "access plus 1 year"
  ExpiresByType text/css         "access plus 1 year"
  ExpiresByType video/x-flv       "access plus 1 year"
  ExpiresByType application/  "access plus 1 year"
  ExpiresByType application/x-font-ttf    "access plus 1 year"
  ExpiresByType application/font-woff    "access plus 1 year"
  ExpiresByType font/opentype      "access plus 1 year"
  ExpiresByType image/webp      "access plus 1 year"

  # The following MIME types are in the process of registration
  ExpiresByType application/xslt+xml    "access plus 1 year"
  ExpiresByType image/svg+xml      "access plus 1 year"

  # The following MIME types are NOT registered
  ExpiresByType application/mathml+xml    "access plus 1 year"
  ExpiresByType application/rss+xml    "access plus 1 year"

  # JavaScript has various MIME types
  ExpiresByType application/x-javascript     "access plus 1 year"
  ExpiresByType application/javascript     "access plus 1 year"
  ExpiresByType text/ecmascript       "access plus 1 year"
  ExpiresByType text/javascript       "access plus 1 year"

# TODO: Set Last-Modified per Google's recommendation to complete browser caching

# -------------------------------------------------------------------------
# Disabling ETags as they are most likely misconfigured and
# do not add functionalit beyond Last-Modified
# -------------------------------------------------------------------------
<IfModule mod_headers.c>
  # Try removing etag headers (if it's coming from proxy for example)
  Header unset ETag

# Remove ETags
FileETag None

On Github License


Download PDF of Htaccess file