# Redirect non-www to www

# Specific redirections
if ($args ~* ^programId=508cf075-bcd7-489d-8a36-292e640748a0$){ rewrite ^/challenge-page/fcaccountabilitypartner$ /challenge-page/fcaccountabilitypartner_programId-508cf075-bcd7-489d-8a36-292e640748a0? permanent; }
if ($args ~* ^feedType=categories$){ rewrite ^/forum$ /forum_feedType-categories? permanent; }
if ($args ~* ^feedType=my-posts$){ rewrite ^/forum$ /forum_feedType-my-posts? permanent; }
if ($args ~* ^sesu003DogcgoIXxbH3hSwB2DHaFcu002DaODLu002DF2ARqlGXqYsu9DU8p4qhtYrZ01lPu002DiLQblnle2eRdVlf4IKcni7Y7PyZfjCold68if6mcH6SLk7EFB2jqThfZ9VZQPBKu15SdBVihQkIkdxDwXpu002DSmu002D34hkzPdQLaWV4R9X5iMo8wsDgrsNjuA2a14UUwJordaFDCDUur9u4bIsK1j8lGB5u002DADqMkVsPRtCoAxNPmeKRRUcGG5jkSDNobfUsZiplCVU8cIcqa218iJYGYnu002DUCcm9K1ebu4kZbtabGu3R2lii_vNfhZ4GxYbjPBiGNmTuNB1TMsSUaxFsdMu002DCKvudY4QYoV0tjHOjN0I_tZu002DnlRon9HjQy7iJE3AH2TGLQu002DFLb62hr1k_u0026cvu003D2$){ rewrite ^/search/tsc\.php$ /files/9K1ebu4kZbtabGu3R2lii_vNfhZ4GxYbjPBiGNmTuNB1TMsSUaxFsdMu002DCKvudY4QYoV0tjHOjN0I_tZu002DnlRon9HjQy7iJE3AH2TGLQu002DFLb62hr1k_u0026cvu003D2_uejkasre7c74haas6d0kxw? 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
