martinberlin/onstage/master/public/.htaccess - Htaccess File


# Helpful sections not specific to CodeIgniter - excerpted from

# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------

<IfModule mod_mime.c>

  # JavaScript
  # Normalize to standard type (it's sniffed in IE anyways)
  AddType application/javascript js jsonp
  AddType application/json json

  # Audio
  AddType audio/mp4 m4a f4a f4b
  AddType audio/ogg oga ogg

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

  # SVG
  # Required for svg webfonts on iPad
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz

  # Webfonts
  AddType application/font-woff woff
  AddType application/ eot
  AddType application/x-font-ttf ttf ttc
  AddType font/opentype otf

  # Assorted types
  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 rss atom xml rdf
  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


# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------

<IfModule mod_deflate.c>

  # Force deflate for mangled headers
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)s*,?s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding

  # Compress all output labeled with one of the following MIME-types
  # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
  # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines as
  # `AddOutputFilterByType` is still in the core directives)
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml 


# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------

# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8

# Force UTF-8 for a number of file formats
<IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .rss .vtt .xml

# ----------------------------------------------------------------------
# A little more security
# ----------------------------------------------------------------------

# To avoid displaying the exact version number of Apache being used, add the
# following to httpd.conf (it will not work in .htaccess):
# ServerTokens Prod

# "-Indexes" will have Apache block users from browsing folders without a
# default document Usually you should leave this activated, because you
# shouldn't allow everybody to surf through every folder on your server (which
# includes rather private places like CMS system folders).
<IfModule mod_autoindex.c>
  Options -Indexes

# Block access to "hidden" directories or files whose names begin with a
# period. This includes directories used by version control systems such as
# Subversion or Git.
<IfModule mod_rewrite.c>
  RewriteCond %{SCRIPT_FILENAME} -d [OR]
  RewriteCond %{SCRIPT_FILENAME} -f
  RewriteRule "(^|/)." - [F]

# Block access to backup and source files. These files may be left by some
# text/html editors and pose a great security danger, when anyone can access
# them.
<FilesMatch "(^#.*#|.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$">
  Order allow,deny
  Deny from all
  Satisfy All

# ----------------------------------------------------------------------
# Start rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  # If you installed Bonfire in a subfolder, you will need to
  # change the following line to match the subfolder you need.
  RewriteBase /

  # Removes access to the system folder by users.
  # Additionally this will allow you to create a System.php controller,
  # previously this would not have been possible.
  # 'system' can be replaced if you have renamed your system folder.

  RewriteCond %{REQUEST_URI} ^bonfire/codeigniter.*
  RewriteRule ^(.*)$ /index.php?/$1 [L]

# Rewrite " ->"

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 index.php

On Github License


Download PDF of Htaccess file