# 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} ^page=2$
RewriteRule ^collections/all-products$ collections/all-products_page-2 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page=2$
RewriteRule ^collections/all$ collections/all_page-2 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page=1&phcursor=eyJhbGciOiJIUzI1NiJ9\.eyJzayI6InRpdGxlIiwic3YiOiJXaGltc3kgQ2hva2VyIiwiZCI6ImIiLCJ1aWQiOjkwNjYzMjgyOTM3MTMsImwiOjE2LCJvIjowLCJyIjoiQ1AifQ\.Z0WMFLQkb8mjgBqukiJhtTvV6-oMm8hwdqG_Upi--NU$
RewriteRule ^collections/all$ files/RpdGxlIiwic3YiOiJXaGltc3kgQ2hva2VyIiwiZCI6ImIiLCJ1aWQiOjkwNjYzMjgyOTM3MTMsImwiOjE2LCJvIjowLCJyIjoiQ1AifQ_Z0WMFLQkb8mjgBqukiJhtTvV6-oMm8hwdqG_Upi--NU_vwtatsrc6wfizuu5kz6qag [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^return_url=\%2Faccount$
RewriteRule ^account/login$ account/login_return_url-_account [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
