John_Betong
08:31:48

HTACCESS OPTIMISATION


BEWARE - IF ANY INCLUDED MODULES ARE MISSING A 500 ERROR WILL OCCUR!
Enabling the <IfModule module_name.c> should clear the error.
Remove # OK to enable module.
Enabling this .htaccess results can be checked in the web page speed tests.
# ----------------------------------------------------------------------
# Environment Name
# ----------------------------------------------------------------------

# Sets the environment that CodeIgniter runs under.
# options: development, production, testing
  SetEnv CI_ENVIRONMENT production

# 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)
  # OK <IfModule mod_filter.c>
    # REQUIRES mod_deflate.c
    # REQUIRES mod_zip.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-ico \
		                  image/x-icon \
		                  text/css \
		                  text/html \
		                  text/plain \
		                  text/x-component \
		                  text/xml
  # OK </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
  # OK <IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
  # OK </IfModule>

  # OK <IfModule mod_headers.c>
    <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
      Header set Cache-Control "max-age=12678400, public"
    </filesmatch>
    <filesmatch "\.(html|htm)$">
      Header set Cache-Control "max-age=17200, private, must-revalidate"
    </filesmatch>
    <filesmatch "\.(pdf)$">
      Header set Cache-Control "max-age=186400, public"
    </filesmatch>
    <filesmatch "\.(js)$">
      Header set Cache-Control "max-age=12678400, private"
    </filesmatch>
  # OK </IfModule>


# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
# OK <IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  # If you installed CodeIgniter 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
  # MAYBE - RewriteBase /
    # RewriteBase /ci2/CodeIgniter4/public

  # MAYBE - Redirect Trailing Slashes...
    # RewriteRule ^(.*)/$ /$1 [L,R=301]

  # MAYBE - Rewrite "www.example.com -> example.com"
    # RewriteCond %{HTTPS} !=on
    # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    # RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

  # FOLLOWING MOVED TO BOTTOM OF FILET TO ENSURE MOD-DEFLATE,CACHING, ETC
    # 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 the front controller, index.php
      # RewriteCond %{REQUEST_FILENAME} !-f
      # RewriteCond %{REQUEST_FILENAME} !-d
      # RewriteRule ^(.*)$ index.php/$1 [L]

  # MAYBE - Ensure Authorization header is passed along
    # RewriteCond %{HTTP:Authorization} .
    # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# OK </IfModule>

# OK <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.
    ErrorDocument 404 index.php
# OK </IfModule>

# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
# OK <IfModule MAYBE_mod_deflate.c>
  # Force deflate for mangled headers 
    # OK <IfModule mod_setenvif.c>
      # OK <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
    # OK </IfModule>
# OK </IfModule>

# OK <IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|ico|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.*
# OK </IfModule>


## EXPIRES CACHING ##
# OK <IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg  "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif  "access 1 year"
  ExpiresByType image/png  "access 1 year"
  ExpiresByType text/css   "access 1 month"
  ExpiresByType text/svg   "access 1 month"
  ExpiresByType image/x-icon      "access 1 year"
  ExpiresByType application/pdf   "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresDefault "access 8 days"
# OK </IfModule>

# MOVED TO ENSURE mod-deflate Expires, Caching, etc works OK
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]


 

Wonderful place for a footer Environment: production Page rendered in 0.0029 seconds.