AddDefaultCharset utf8
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Removes access to the system folders by users.
    RedirectMatch 403 ^/application/?.*$
    RedirectMatch 403 ^/vendor/?.*$

    # Redirect to https
#    RewriteCond %{HTTPS} off
#    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Redirect to www
    RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Redirect from "index.php" to "/"
    RewriteCond %{THE_REQUEST} ^.*/index\.php
    RewriteRule ^(.*)index.php\/?(.*)$ /$1$2 [R=301,L]

    # Redirect from "home" to "/"
    RewriteRule ^home$ / [R=301,L]
    RewriteRule ^home\/(.*)$ /$1 [R=301,L]

    # Replace "/" at the end of uri
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\/$ /$1 [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
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0

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

    # 1 WEEK
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|txt|xml|js|css)$">
    ExpiresDefault A604800
    </FilesMatch>
</IfModule>