# Redirect non-www to www

# Specific redirections
if ($args ~* ^next=0$){ rewrite ^/$ /next-0? permanent; }
if ($args ~* ^next=36$){ rewrite ^/$ /next-36? permanent; }
if ($args ~* ^next=72$){ rewrite ^/$ /next-72? permanent; }
if ($args ~* ^next=108$){ rewrite ^/$ /next-108? permanent; }
if ($args ~* ^next=0$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-0? permanent; }
if ($args ~* ^next=36$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-36? permanent; }
if ($args ~* ^next=72$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-72? permanent; }
if ($args ~* ^next=144$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-144? permanent; }
if ($args ~* ^next=4896$){ rewrite ^/$ /next-4896? permanent; }
if ($args ~* ^next=4932$){ rewrite ^/$ /next-4932? permanent; }
if ($args ~* ^next=4968$){ rewrite ^/$ /next-4968? permanent; }
if ($args ~* ^next=180$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-180? permanent; }
if ($args ~* ^next=4788$){ rewrite ^/$ /next-4788? permanent; }
if ($args ~* ^next=4824$){ rewrite ^/$ /next-4824? permanent; }
if ($args ~* ^next=216$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-216? permanent; }
if ($args ~* ^next=252$){ rewrite ^/escorts/estonia/parnu$ /escorts/estonia/parnu_next-252? permanent; }
if ($args ~* ^next=4752$){ rewrite ^/$ /next-4752? permanent; }
if ($args ~* ^next=4680$){ rewrite ^/$ /next-4680? permanent; }
if ($args ~* ^next=4716$){ rewrite ^/$ /next-4716? permanent; }
if ($args ~* ^next=4644$){ rewrite ^/$ /next-4644? permanent; }
if ($args ~* ^next=4572$){ rewrite ^/$ /next-4572? permanent; }
if ($args ~* ^next=4608$){ rewrite ^/$ /next-4608? permanent; }
if ($args ~* ^next=2880$){ rewrite ^/$ /next-2880? permanent; }
if ($args ~* ^next=2916$){ rewrite ^/$ /next-2916? permanent; }
if ($args ~* ^next=2952$){ rewrite ^/$ /next-2952? permanent; }
if ($args ~* ^next=2988$){ rewrite ^/$ /next-2988? permanent; }
if ($args ~* ^next=3024$){ rewrite ^/$ /next-3024? permanent; }
if ($args ~* ^next=3060$){ rewrite ^/$ /next-3060? permanent; }
if ($args ~* ^next=3096$){ rewrite ^/$ /next-3096? permanent; }
if ($args ~* ^next=3132$){ rewrite ^/$ /next-3132? permanent; }
if ($args ~* ^next=3240$){ rewrite ^/$ /next-3240? permanent; }
if ($args ~* ^next=3276$){ rewrite ^/$ /next-3276? permanent; }
if ($args ~* ^next=3312$){ rewrite ^/$ /next-3312? 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
