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