grrr-amsterdam/garp_scaffold/master/public/.htaccess - Htaccess File

grrr-amsterdam/garp_scaffold/master/public/.htaccess

# pass the default character set
AddDefaultCharset UTF-8

SetEnvIf Host ^staging.(.*) APPLICATION_ENV=staging
SetEnvIf Host integration.grrr.nl$ APPLICATION_ENV=integration
SetEnvIf Host ^localhost.(.*) APPLICATION_ENV=development

php_value upload_max_filesize 30M
php_value post_max_size 30M

# Proper MIME types
<IfModule mod_mime.c>
  # Audio
    AddType audio/mp4                                   m4a f4a f4b
    AddType audio/ogg                                   oga ogg

  # JavaScript
    # Normalize to standard type (it's sniffed in IE anyways):
    # http://tools.ietf.org/html/rfc4329#section-7.2
    AddType application/javascript                      js
    AddType application/json                            json

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

  # Web fonts
    AddType application/x-font-woff                     woff
    AddType application/font-woff2            woff2
    AddType application/vnd.ms-fontobject               eot

    # Browsers usually ignore the font MIME types and sniff the content,
    # however, Chrome shows a warning if other MIME types are used for the
    # following fonts.
    AddType application/x-font-ttf                      ttc ttf
    AddType font/opentype                               otf

    # Make SVGZ fonts work on iPad:
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType     image/svg+xml                           svg svgz
    AddEncoding gzip                                    svgz

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

# cache rules
<IfModule mod_expires.c>
  ExpiresActive on

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

  # favicon (cannot be renamed)
  ExpiresByType image/vnd.microsoft.icon  "access plus 1 week"
  ExpiresByType image/x-icon              "access plus 1 week"

  # 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/vnd.ms-fontobject "access plus 1 month"

  # css and javascript
  ExpiresByType text/css                  "access plus 1 month"
  ExpiresByType application/javascript    "access plus 1 month"
  ExpiresByType text/javascript           "access plus 1 month"
  ExpiresByType application/x-javascript   "access plus 1 month"

  ExpiresByType image/x-icon              "access plus 1 day"
  ExpiresByType application/xhtml+xml     "access plus 300 seconds"
  ExpiresByType text/html                 "access plus 300 seconds"
  ExpiresByType application/xml           "access plus 300 seconds"

  Header append Cache-Control "public"
</IfModule>

# rewrite rules
<IfModule mod_rewrite.c>
  RewriteEngine On

  # allow versioning of asset files (e.g. /123/css/screen.css)
  RewriteRule ^(?:(nl|en|de|fr|us|it|hu)/?)?(?:[0-9a-z]+/?)?/(css|js|media)/(.*) $2/$3 [L]

  # require no-www
  # RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

  # Disregard slash at the end of request
  RewriteRule ^(.*)/$ /$1 [L]

  # Work with Zend static cache
  # Homepage
  RewriteCond %{REQUEST_METHOD} GET
  RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
  RewriteRule ^/*$ cached/index.html [L]

  # Pages with query string ?foo=bar
  RewriteCond %{QUERY_STRING} .+
  RewriteCond %{REQUEST_METHOD} GET
  RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}?%{QUERY_STRING}.html -f
  RewriteRule .* cached/%{REQUEST_URI}%3F%{QUERY_STRING}.html [L]

  # Pages with query string and slash at the end /?foo=bar
  RewriteCond %{QUERY_STRING} .+
  RewriteCond %{REQUEST_METHOD} GET
  RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}/?%{QUERY_STRING}.html -f
  RewriteRule .* cached/%{REQUEST_URI}/%3F%{QUERY_STRING}.html [L]

  # Pages without query string
  RewriteCond %{REQUEST_METHOD} GET
  RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.html -f
  RewriteRule .* cached/%{REQUEST_URI}.html [L]

  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
  RewriteRule ^.*$ index.php [NC,L]

</IfModule>

<IfModule mod_deflate.c>
  # compress text, html, javascript, css, xml, svg:
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript image/svg+xml application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
</IfModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, DOCUMENT_ROOT, ENV, GET, HTTP_HOST, QUERY_STRING, REQUEST_FILENAME, REQUEST_METHOD, REQUEST_URI, static

Comments

Apache