tobymackenzie/html-boilerplate/master/src/web/.htaccess - Htaccess File


# .htaccess for apache.  do equivalent settings for other servers
# This stuff generally should be moved to server configuration files for performance reasons if possible, as .htaccess must be processed on for each request and looked for in each directory.  See <> for more details.
# See <> for more ideas
<IfModule mod_rewrite.c>
  RewriteEngine On

  #==prevent access to forbidden files
  #===dot files
  #-@ HTML5 Boilerplate:
  RewriteCond %{SCRIPT_FILENAME} -f [OR]
  RewriteCond %{SCRIPT_FILENAME} -d
  RewriteRule "(^|/)." - [F]

  #==enable if using a file to route requests
  # RewriteCond %{REQUEST_FILENAME} !-f
  # RewriteCond %{REQUEST_FILENAME} !-d
  # RewriteRule ^(.*)$ router.php [QSA,L]

#==allow following of symlinks
Options +FollowSymlinks

#==tell IE to use latest rendering engine
#-@ HTML5 Boilerplate:
<IfModule mod_headers.c>
  Header set X-UA-Compatible "IE=edge"
  # `mod_headers` can't match based on the content-type, however, we only
  # want to send this header for HTML pages and not for the other resources
  <FilesMatch ".(appcache|crx|css|cur|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|opus|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
    Header unset X-UA-Compatible

#==compress appropriate files
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript text/css text/html text/javascript text/plain text/xml

On Github License


Download PDF of Htaccess file