Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes

AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

php_value session.gc_maxlifetime 21600
php_value session.cookie_lifetime 21600

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

<ifModule mod_deflate.c>
  <IfModule mod_filter.c>
      AddOutputFilterByType DEFLATE text/plain text/html
      AddOutputFilterByType DEFLATE text/css
      AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
      AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/rss+xml
      AddOutputFilterByType DEFLATE application/json
      AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon
      AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml
  </ifModule>
</ifModule>
<ifModule mod_headers.c>
    <FilesMatch "\.(html|js|css)$">
	Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <Files *.txt>
	Header add Cache-Control "max-age=43200, public"
    </Files>
    <FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
	Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
	Header unset Cache-Control
    </FilesMatch>
</IfModule>
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 10 month"
    ExpiresByType image/gif                 "access plus 1 month"
    ExpiresByType image/png                 "access plus 1 month"
    ExpiresByType image/jpg                 "access plus 1 month"
    ExpiresByType image/jpeg                "access plus 1 month"
    ExpiresByType text/css                  "access plus 1 year"
    ExpiresByType application/javascript    "access plus 1 year"
    ExpiresByType text/javascript           "access plus 1 year"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType application/x-font-ttf "access plus 1 year"
    ExpiresByType application/x-font-opentype "access plus 1 year"
    ExpiresByType application/x-font-woff "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>

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

# Prevent Direct Access to files
#<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
<FilesMatch "(?i)((\.tpl|\.ini|\.log))">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
RewriteCond %{HTTPS} on
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule .* http://%1/$0 [L,R=301]

RewriteBase /
RewriteRule ^catalogs/catalogs/(.*) /catalogs/$1 [R=301,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^market.yml$ index.php?route=payment/yandex_money/market [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,QSA,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule tag/(.*?)/([0-9]+)/$ index.php?route=product/search&tag=$1&page=$2 [L,QSA]
RewriteRule tag/(.*?)/$ index.php?route=product/search&tag=$1 [L,QSA]
RewriteRule search/(.*?)/$ index.php?route=product/search&search=$1 [L,QSA]
RewriteRule catalog/price/$ index.php?route=product/category&path=75&sale [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]