Femaref/candyCMS/master/.htaccess - Htaccess File

Femaref/candyCMS/master/.htaccess

# Many rules are taken from
# http://github.com/paulirish/html5-boilerplate/blob/master/.htaccess

# Add PHP5 support
#AddHandler php53-cgi .php

# Custom error pages
ErrorDocument 404 /errors/404
ErrorDocument 422 /errors/422
ErrorDocument 500 /errors/500

# Hide files for non script access
<FilesMatch ".(sql|gz|tpl|mob|ini|yml|php|log)$">
  order allow,deny
  deny from all
</FilesMatch>

<Files index.php>
  Allow from all
</Files>

Options +FollowSymLinks
RewriteEngine On

# redirect existing files and symbolic links
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^.*$ - [NC,L]

# rewrite tools and install folders
RewriteRule tools - [NC,L]
RewriteRule install - [NC,L]

# rewrite all other calls to our index.php
RewriteRule ^.*$ index.php [NC,L]

# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    BrowserMatch MSIE ie
    Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  </IfModule>
</IfModule>

# Cache files
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault A0

  # 1 YEAR
  <FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    ExpiresDefault A9030400
  </FilesMatch>

  # 1 WEEK
  <FilesMatch ".(jpg|jpeg|png|gif|swf)$">
    ExpiresDefault A604800
  </FilesMatch>

  # 3 HOUR
  <FilesMatch ".(txt|xml|js|css)$">
    ExpiresDefault A604800
  </FilesMatch>

  # Microsoft icon support
  AddType image/vnd.microsoft.icon .ico
  ExpiresByType image/vnd.microsoft.icon "access plus 3 months"
</IfModule>

<ifModule mod_headers.c>
  # 1 YEAR
  <FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    Header set Cache-Control "max-age=29030400, public"
  </FilesMatch>

  # 1 WEEK
  <FilesMatch ".(jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=604800, public"
  </FilesMatch>

  # 5 HOUR
  <FilesMatch ".(txt|xml|js|css)$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>

  # NEVER CACHE
  <FilesMatch ".(html|htm|php|cgi|pl|less)$">
    Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
  </FilesMatch>

  # hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
  # Disabled. Uncomment to serve cross-domain ajax requests
  Header set Access-Control-Allow-Origin "*"
</ifModule>

# Use gzip to compress data stream
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/html text/plain text/css application/x-javascript text/javascript application/javascript application/json text/xml application/xml text/x-component
</IfModule>

<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.*
</ifModule>

# Since we're sending far-future expires, we don't need ETags for static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None

# Add modern filetypes
# video
AddType video/ogg  ogg ogv
AddType video/mp4  mp4
AddType video/webm webm

# Proper svg serving. Required for svg webfonts on iPad
#   twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml                 svg svgz

# webfonts
AddType application/vnd.ms-fontobject eot
AddType font/ttf                      ttf
AddType font/otf                      otf
AddType font/x-woff                   woff

ServerSignature Off

On Github License

Files

Download PDF of Htaccess file
CACHE, DEFLATE, no-cache, REQUEST_FILENAME, static

Comments

Apache