chrismademe/ga/master/.htaccess - Htaccess File


# Enable PHP 5.4
# AddType application/x-httpd-php54 .php

RewriteEngine on

## Force www.
#RewriteCond %{HTTP_HOST} !^$
#RewriteCond %{HTTP_HOST} !^www. [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

## Push everything through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]

# Deny Access to sensitive files directly.
<Files ~ "(.yml|.twig|.inc|.sql)">
    Order allow,deny
    Deny from all

# Additional Security for htaccess
<Files .htaccess>
    Order allow,deny
    Deny from all

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
# @NOTE: I recommend disabling this mod_expires on your local machine
# so that you don't need to re-version your assets everytime you make
# a change!
# These are pretty far-future expires headers
# They assume you control versioning with cachebusting query params like:
#   <script src="application.js?20100608">
# Additionally, consider that outdated proxies may miscache

# If you don`t use filenames to version, lower the css and js to something like "access plus 1 week"

<IfModule mod_expires.c>
    ExpiresActive on

    # Perhaps better to whitelist expires rules? Perhaps.
    ExpiresDefault                              "access plus 1 month"

    # cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest           "access plus 0 seconds"

    # Your document html
    ExpiresByType text/html                     "access plus 0 seconds"

    # Data
    ExpiresByType text/xml                      "access plus 0 seconds"
    ExpiresByType application/xml               "access plus 0 seconds"
    ExpiresByType application/json              "access plus 0 seconds"

    # RSS feed
    ExpiresByType application/rss+xml           "access plus 1 hour"

    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon                  "access plus 1 week"

    # Media: images, video, audio
    ExpiresByType image/gif                     "access plus 1 month"
    ExpiresByType image/png                     "access plus 1 month"
    ExpiresByType image/jpg                     "access plus 1 month"
    ExpiresByType image/jpeg                    "access plus 1 month"
    ExpiresByType video/ogg                     "access plus 1 month"
    ExpiresByType audio/ogg                     "access plus 1 month"
    ExpiresByType video/mp4                     "access plus 1 month"
    ExpiresByType video/webm                    "access plus 1 month"

    # HTC files  (css3pie)
    ExpiresByType text/x-component              "access plus 1 month"

    # Webfonts
    ExpiresByType font/truetype                 "access plus 1 month"
    ExpiresByType font/opentype                 "access plus 1 month"
    ExpiresByType application/x-font-woff       "access plus 1 month"
    ExpiresByType image/svg+xml                 "access plus 1 month"
    ExpiresByType application/ "access plus 1 month"

    # CSS and JavaScript
    ExpiresByType text/css                      "access plus 1 year"
    ExpiresByType application/javascript        "access plus 1 year"
    ExpiresByType text/javascript               "access plus 1 year"

    <IfModule mod_headers.c>
        Header append Cache-Control "public"


# GZIP Compression
<IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

On Github License


Download PDF of Htaccess file