# Specific redirections
if ($args ~* ^cid=1$){ rewrite ^/catalog\.aspx$ /catalog_cid-1? permanent; }
if ($args ~* ^cid=10$){ rewrite ^/catalog\.aspx$ /catalog_cid-10? permanent; }
if ($args ~* ^cid=11$){ rewrite ^/catalog\.aspx$ /catalog_cid-11? permanent; }
if ($args ~* ^cid=12$){ rewrite ^/catalog\.aspx$ /catalog_cid-12? permanent; }
if ($args ~* ^cid=14$){ rewrite ^/catalog\.aspx$ /catalog_cid-14? permanent; }
if ($args ~* ^cid=16$){ rewrite ^/catalog\.aspx$ /catalog_cid-16? permanent; }
if ($args ~* ^cid=17$){ rewrite ^/catalog\.aspx$ /catalog_cid-17? permanent; }
if ($args ~* ^cid=18$){ rewrite ^/catalog\.aspx$ /catalog_cid-18? permanent; }
if ($args ~* ^cid=19$){ rewrite ^/catalog\.aspx$ /catalog_cid-19? permanent; }
if ($args ~* ^cid=20$){ rewrite ^/catalog\.aspx$ /catalog_cid-20? permanent; }
if ($args ~* ^cid=21$){ rewrite ^/catalog\.aspx$ /catalog_cid-21? permanent; }
if ($args ~* ^cid=22$){ rewrite ^/catalog\.aspx$ /catalog_cid-22? permanent; }
if ($args ~* ^cid=23$){ rewrite ^/catalog\.aspx$ /catalog_cid-23? permanent; }
if ($args ~* ^cid=24$){ rewrite ^/catalog\.aspx$ /catalog_cid-24? permanent; }
if ($args ~* ^cid=25$){ rewrite ^/catalog\.aspx$ /catalog_cid-25? permanent; }
if ($args ~* ^cid=26$){ rewrite ^/catalog\.aspx$ /catalog_cid-26? permanent; }
if ($args ~* ^cid=27$){ rewrite ^/catalog\.aspx$ /catalog_cid-27? permanent; }
if ($args ~* ^cid=28$){ rewrite ^/catalog\.aspx$ /catalog_cid-28? permanent; }
if ($args ~* ^cid=29$){ rewrite ^/catalog\.aspx$ /catalog_cid-29? permanent; }
if ($args ~* ^cid=3$){ rewrite ^/catalog\.aspx$ /catalog_cid-3? permanent; }
if ($args ~* ^cid=30$){ rewrite ^/catalog\.aspx$ /catalog_cid-30? permanent; }
if ($args ~* ^cid=4$){ rewrite ^/catalog\.aspx$ /catalog_cid-4? permanent; }
if ($args ~* ^cid=5$){ rewrite ^/catalog\.aspx$ /catalog_cid-5? permanent; }
if ($args ~* ^cid=9$){ rewrite ^/catalog\.aspx$ /catalog_cid-9? permanent; }
if ($args ~* ^cid=1$){ rewrite ^/catalog1\.aspx$ /catalog1_cid-1? permanent; }
rewrite ^/top\+/top\+\.htm$ /top-/top-? 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
