Forum Moderators: phranque
# ---------------------------------------------------------
# Some extra security
# ---------------------------------------------------------
<Files ".htaccess">
order allow,deny
deny from all
</Files>
Options +FollowSymLinks
# ---------------------------------------------------------
# Prevent directory browsing & access to .dirs
# ---------------------------------------------------------
Options -Indexes
IndexIgnore *
<IfModule mod_rewrite.c>
RewriteRule "(^|/)\." - [F]
</IfModule>
# ---------------------------------------------------------
# Scripts
# ---------------------------------------------------------
Options +ExecCGI
AddHandler cgi-script cgi
Options +Includes
XBitHack on
# ---------------------------------------------------------
# Make sure we show te right page
# ---------------------------------------------------------
DirectoryIndex index.php index.html
# ---------------------------------------------------------
# MIME types (partly from html5 boilerplate)
# ---------------------------------------------------------
AddType audio/ogg oga ogg spx
AddType audio/flac flac
AddType video/ogg ogv
AddType video/mp4 mp4
AddType video/webm webm
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType font/opentype otf
AddType application/x-font-woff woff
AddType image/x-icon ico
AddType application/x-httpd-php inc
# ---------------------------------------------------------
# Set Charset and Headers
# ---------------------------------------------------------
AddCharset UTF-8 .htm .html .php .inc .css .js .xml .json .rss
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(html|htm|php)$">
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
Header set imagetoolbar "no" env=ie
</FilesMatch>
Header append Vary User-Agent
</IfModule>
</IfModule>
# ---------------------------------------------------------
# Configure cache-ing (css is dynamic)
# ---------------------------------------------------------
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 years"
<FilesMatch "\.(htm|html|xml|txt|php|inc)$">
ExpiresDefault "access plus 1 seconds"
</FilesMatch>
</ifModule>
<ifModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</ifModule>
FileETag None
# ---------------------------------------------------------
# Compression
# ---------------------------------------------------------
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|htm|html|xml|inc|php|ttf|otf|eot|svg)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# ---------------------------------------------------------
# Custom errors
# ---------------------------------------------------------
Options -MultiViews
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
Header set imagetoolbar "no" env=ie