Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine on
# Osiguraj da koristiš HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Osiguraj da koristiš www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteBase /

RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

RewriteRule ^images/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /helpers/mdl_displayimage.php?id=$1&quality=$2&size=$3&name=$4 [L]
RewriteRule ^images/([^/]*)/([^/]*)/([^/]*)$ /helpers/mdl_displayimage.php?type=$1&id=$2&name=$3 [L]

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


Options -MultiViews
RewriteBase /

RewriteCond %{REQUEST_FILENAME}  -f
RewriteRule  ^/(.+)  $1  [L]

<IfModule mod_deflate.c>
  # Force compression for the following file types
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript

  # Or, compress certain file types by extension
  # <FilesMatch "\.(js|css|html|txt|xml|x?html?|php)$">
  #   SetOutputFilter DEFLATE
  # </FilesMatch>
</IfModule>



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

 # 1 Month for all your static assets
 <filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|webp|woff)$">
 Header set Cache-Control "max-age=31536000, public"
 </filesMatch>

 # 1 DAYS for rss feeds and robots
 <filesMatch ".(xml|txt)$">
 Header set Cache-Control "max-age=86400, public, must-revalidate"
 </filesMatch>

 # 4 HOURS for your real articles files
 <filesMatch ".(html|htm)$">
 Header set Cache-Control "max-age=14400, must-revalidate"
 </filesMatch>

<ifModule mod_headers.c>
  Header unset ETag
</ifModule>
FileETag None


# ----------------------------------------------------------------------
# | Server software information                                        |
# ----------------------------------------------------------------------

# Prevent Apache from adding a trailing footer line containing
# information about the server to the server-generated documents
# (e.g.: error messages, directory listings, etc.)
#
# https://httpd.apache.org/docs/current/mod/core.html#serversignature

ServerSignature Off