# Specific redirections
if ($args ~* ^page=2$){ rewrite ^/collections/all-products$ /collections/all-products_page-2? permanent; }
if ($args ~* ^page=2$){ rewrite ^/collections/all$ /collections/all_page-2? permanent; }
if ($args ~* ^page=1&phcursor=eyJhbGciOiJIUzI1NiJ9\.eyJzayI6InRpdGxlIiwic3YiOiJXaGltc3kgQ2hva2VyIiwiZCI6ImIiLCJ1aWQiOjkwNjYzMjgyOTM3MTMsImwiOjE2LCJvIjowLCJyIjoiQ1AifQ\.Z0WMFLQkb8mjgBqukiJhtTvV6-oMm8hwdqG_Upi--NU$){ rewrite ^/collections/all$ /files/RpdGxlIiwic3YiOiJXaGltc3kgQ2hva2VyIiwiZCI6ImIiLCJ1aWQiOjkwNjYzMjgyOTM3MTMsImwiOjE2LCJvIjowLCJyIjoiQ1AifQ_Z0WMFLQkb8mjgBqukiJhtTvV6-oMm8hwdqG_Upi--NU_vwtatsrc6wfizuu5kz6qag? permanent; }
if ($args ~* ^return_url=\%2Faccount$){ rewrite ^/account/login$ /account/login_return_url-_account? permanent; }

# Create pretty URLs
rewrite ^/([^/]+)$ /$1.html last;
rewrite ^/([^/]+)/([^/]+)$ /$1/$2.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8/$9.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8/$9/$10.html last;
# End: Create pretty URLs

# Redirect all extensions to html
if ($is_args = ''){
	rewrite ^([^.]*)\.shtml$ $1.html permanent;
	rewrite ^([^.]*)\.phtml$ $1.html permanent;
	rewrite ^([^.]*)\.jhtml$ $1.html permanent;
	rewrite ^([^.]*)\.htm$ $1.html permanent;
	rewrite ^([^.]*)\.php$ $1.html permanent;
	rewrite ^([^.]*)\.aspx$ $1.html permanent;
	rewrite ^([^.]*)\.asp$ $1.html permanent;
	rewrite ^([^.]*)\.jsp$ $1.html permanent;
	rewrite ^([^.]*)\.apk$ $1.html permanent;
}
# End: Redirect all extensions to html
