# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>

# Prevent directory browsing
IndexIgnore */*

# Set the default handler
DirectoryIndex index.php

RewriteRule ^(contact|about|add-to-cart|cart|rss-feed|advanced-search|checkout|licence|cancel|thanks|clear-cart|view-cart).html$ index.php?cmd=$1
RewriteRule ^index.html$ index.php
RewriteRule ^category/(.*)/(.*)/(.*)/index.html index.php?cmd=category&category=$1&page=$3 [nc]
RewriteRule ^category/(.*)/(.*)/index.html index.php?cmd=category&category=$1 [nc]
RewriteRule ^picture/(.*)/(.*)/(.*)/(.*).html index.php?cmd=pictures&picture=$1&page=$2 [nc]
RewriteRule ^picture/(.*)/(.*)/(.*).html index.php?cmd=pictures&picture=$1 [nc]
RewriteRule ^view-picture/(.*)/(.*)/(.*).html index.php?cmd=view-picture&picture=$1 [nc]
RewriteRule ^slideshow/(.*)/(.*)/(.*)/index.html index.php?cmd=slideshow&category=$1&speed=$2 [nc]
RewriteRule ^slideshow/(.*)/(.*)/index.html index.php?cmd=slideshow&category=$1 [nc]
RewriteRule ^question/(.*)/index.html index.php?cmd=ask-question&picture=$1 [nc]
RewriteRule ^comment/(.*)/(.*)/(.*).html index.php?cmd=leave-comment&picture=$1 [nc]
RewriteRule ^verify/(.*)/index.html index.php?cmd=verify&code=$1 [nc]
RewriteRule ^delete-cart-item/(.*)/index.html index.php?cmd=delete-cart-item&id=$1 [nc]

# URL rewrite rules
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

# COMPRESSION
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/opentype
  # For older browsers that can`t handle compression
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

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