# invoke rewrite engine
RewriteEngine On
RewriteBase /

Options -Indexes
<IfModule mod_negotiation.c>
	Options -MultiViews
</IfModule>

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Create pretty URLs
DirectorySlash Off

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
# End: Create pretty URLs

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^categoryID=87$
RewriteRule ^shop/index\.php$ shop/index_categoryID-87.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^categoryID=90$
RewriteRule ^shop/index\.php$ shop/index_categoryID-90.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^categoryID=91$
RewriteRule ^shop/index\.php$ shop/index_categoryID-91.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^killuser=yes$
RewriteRule ^shop/index\.php$ shop/index_killuser-yes.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^productID=221$
RewriteRule ^shop/index\.php$ shop/index_productID-221.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^productID=222$
RewriteRule ^shop/index\.php$ shop/index_productID-222.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^productID=223$
RewriteRule ^shop/index\.php$ shop/index_productID-223.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^productID=226$
RewriteRule ^shop/index\.php$ shop/index_productID-226.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^shopping_cart=yes$
RewriteRule ^shop/index\.php$ shop/index_shopping_cart-yes.html [L,R=301,QSD]

# Redirect all extensions to html
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.phtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jhtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.htm$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.php$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.aspx$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jsp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.apk$ $1.html [L,NC,R=301]
# End: Redirect all extensions to html
