brkrishna/freelance/master/dms/public/1.htaccess - Htaccess File

brkrishna/freelance/master/dms/public/1.htaccess

# Helpful sections not specific to CodeIgniter - excerpted from
# https://github.com/h5bp/server-configs/

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

<IfModule mod_mime.c>

  # JavaScript
  # Normalize to standard type (it's sniffed in IE anyways)
  # tools.ietf.org/html/rfc4329#section-7.2
  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
  # twitter.com/FontSquirrel/status/14855840545
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz

  # Webfonts
  AddType application/font-woff woff
  AddType application/vnd.ms-fontobject 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

</IfModule>

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

<IfModule mod_deflate.c>

  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <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
    </IfModule>
  </IfModule>

  # 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 
                                  application/javascript 
                                  application/json 
                                  application/rss+xml 
                                  application/vnd.ms-fontobject 
                                  application/x-font-ttf 
                                  application/xhtml+xml 
                                  application/xml 
                                  font/opentype 
                                  image/svg+xml 
                                  image/x-icon 
                                  text/css 
                                  text/html 
                                  text/plain 
                                  text/x-component 
                                  text/xml
  </IfModule>

</IfModule>

# ----------------------------------------------------------------------
# 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
</IfModule>

# ----------------------------------------------------------------------
# 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
</IfModule>

# 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]
</IfModule>

# 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
</FilesMatch>

# ----------------------------------------------------------------------
# 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.
  # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
  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]
</IfModule>

# Rewrite "www.example.com -> example.com"

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

# 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>

<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
</IfModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, HTTP_HOST, HTTPS, REQUEST_FILENAME, REQUEST_URI, SCRIPT_FILENAME

Comments

Apache