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

# Prevent scraping from archive for free demo
RewriteCond %{HTTP_USER_AGENT} (ia_archiver) [NC]
RewriteRule . - [F,L]

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ index_route-common_home [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/login$
RewriteRule ^index\.php$ index_route-account_login [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/register$
RewriteRule ^index\.php$ index_route-account_register [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/wishlist$
RewriteRule ^index\.php$ index_route-account_wishlist [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/account$
RewriteRule ^index\.php$ index_route-account_account [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=checkout/cart$
RewriteRule ^index\.php$ index_route-checkout_cart [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=checkout/checkout$
RewriteRule ^index\.php$ index_route-checkout_checkout [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=information/information&information_id=31$
RewriteRule ^index\.php$ index_route-information_information-information_id-31 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=product/category&path=67$
RewriteRule ^index\.php$ index_route-product_category-path-67 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=product/category&path=68$
RewriteRule ^index\.php$ index_route-product_category-path-68 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=product/category&path=70$
RewriteRule ^index\.php$ index_route-product_category-path-70 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=product/manufacturer$
RewriteRule ^index\.php$ index_route-product_manufacturer [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=information/news$
RewriteRule ^index\.php$ index_route-information_news [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/voucher$
RewriteRule ^index\.php$ index_route-account_voucher [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/order$
RewriteRule ^index\.php$ index_route-account_order [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=module/language$
RewriteRule ^index\.php$ index_route-module_language [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=module/currency$
RewriteRule ^index\.php$ index_route-module_currency [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/forgotten$
RewriteRule ^index\.php$ index_route-account_forgotten [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/address$
RewriteRule ^index\.php$ index_route-account_address [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/download$
RewriteRule ^index\.php$ index_route-account_download [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/return$
RewriteRule ^index\.php$ index_route-account_return [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/transaction$
RewriteRule ^index\.php$ index_route-account_transaction [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/newsletter$
RewriteRule ^index\.php$ index_route-account_newsletter [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/recurring$
RewriteRule ^index\.php$ index_route-account_recurring [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=information/information/info&information_id=3$
RewriteRule ^index\.php$ index_route-information_information_info-information_id-3 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^route=account/register/country&country_id=$
RewriteRule ^index\.php$ index_route-account_register_country-country_id [L,R=301,QSD]

# Create pretty URLs
DirectorySlash Off

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ %1 [NC,L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)/$ $1 [NC,L,R=301]

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

# 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
