# invoke rewrite engine
RewriteEngine On
RewriteBase /

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

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^i=1$
RewriteRule ^purchase\.php$ purchase_i-1 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=2$
RewriteRule ^purchase\.php$ purchase_i-2 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=3$
RewriteRule ^purchase\.php$ purchase_i-3 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=4$
RewriteRule ^purchase\.php$ purchase_i-4 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=5$
RewriteRule ^purchase\.php$ purchase_i-5 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=6$
RewriteRule ^purchase\.php$ purchase_i-6 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=7$
RewriteRule ^purchase\.php$ purchase_i-7 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^i=8$
RewriteRule ^purchase\.php$ purchase_i-8 [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
