# Redirect non-www to www

# Specific redirections
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/A$ /taxonomy/term/150/A_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/B$ /taxonomy/term/150/B_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/C$ /taxonomy/term/150/C_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/D$ /taxonomy/term/150/D_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/F$ /taxonomy/term/150/F_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/G$ /taxonomy/term/150/G_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/H$ /taxonomy/term/150/H_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/J$ /taxonomy/term/150/J_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/K$ /taxonomy/term/150/K_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/L$ /taxonomy/term/150/L_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/M$ /taxonomy/term/150/M_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/N$ /taxonomy/term/150/N_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/P$ /taxonomy/term/150/P_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/R$ /taxonomy/term/150/R_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/S$ /taxonomy/term/150/S_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/T$ /taxonomy/term/150/T_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/W$ /taxonomy/term/150/W_keys? permanent; }
if ($args ~* ^profile=961$){ rewrite ^/post/contact-us$ /post/contact-us_profile-961? permanent; }
if ($args ~* ^profile=846$){ rewrite ^/post/contact-us$ /post/contact-us_profile-846? permanent; }
if ($args ~* ^profile=833$){ rewrite ^/post/contact-us$ /post/contact-us_profile-833? permanent; }
if ($args ~* ^profile=832$){ rewrite ^/post/contact-us$ /post/contact-us_profile-832? permanent; }
if ($args ~* ^profile=835$){ rewrite ^/post/contact-us$ /post/contact-us_profile-835? permanent; }
if ($args ~* ^profile=848$){ rewrite ^/post/contact-us$ /post/contact-us_profile-848? permanent; }
if ($args ~* ^profile=831$){ rewrite ^/post/contact-us$ /post/contact-us_profile-831? permanent; }
if ($args ~* ^profile=956$){ rewrite ^/post/contact-us$ /post/contact-us_profile-956? permanent; }
if ($args ~* ^profile=838$){ rewrite ^/post/contact-us$ /post/contact-us_profile-838? permanent; }
if ($args ~* ^profile=841$){ rewrite ^/post/contact-us$ /post/contact-us_profile-841? permanent; }
if ($args ~* ^profile=836$){ rewrite ^/post/contact-us$ /post/contact-us_profile-836? permanent; }
if ($args ~* ^profile=1154$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1154? permanent; }
if ($args ~* ^profile=845$){ rewrite ^/post/contact-us$ /post/contact-us_profile-845? permanent; }
if ($args ~* ^profile=850$){ rewrite ^/post/contact-us$ /post/contact-us_profile-850? permanent; }
if ($args ~* ^profile=1200$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1200? permanent; }
if ($args ~* ^profile=1168$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1168? permanent; }
if ($args ~* ^profile=840$){ rewrite ^/post/contact-us$ /post/contact-us_profile-840? permanent; }
if ($args ~* ^profile=1153$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1153? permanent; }
if ($args ~* ^page=1$){ rewrite ^/staff$ /staff_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/bear-essentials-newsletter$ /bear-essentials-newsletter_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/principal-communication$ /principal-communication_page-1? permanent; }
if ($args ~* ^page=2$){ rewrite ^/principal-communication$ /principal-communication_page-2? permanent; }
if ($args ~* ^page=3$){ rewrite ^/principal-communication$ /principal-communication_page-3? permanent; }
if ($args ~* ^page=4$){ rewrite ^/principal-communication$ /principal-communication_page-4? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/B$ /taxonomy/term/150/B_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/C$ /taxonomy/term/150/C_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/D$ /taxonomy/term/150/D_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/F$ /taxonomy/term/150/F_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/G$ /taxonomy/term/150/G_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/H$ /taxonomy/term/150/H_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/K$ /taxonomy/term/150/K_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/L$ /taxonomy/term/150/L_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/M$ /taxonomy/term/150/M_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/N$ /taxonomy/term/150/N_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/P$ /taxonomy/term/150/P_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/R$ /taxonomy/term/150/R_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/S$ /taxonomy/term/150/S_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/T$ /taxonomy/term/150/T_page-1-keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/W$ /taxonomy/term/150/W_page-1-keys? permanent; }
if ($args ~* ^profile=852$){ rewrite ^/post/contact-us$ /post/contact-us_profile-852? permanent; }
if ($args ~* ^profile=1190$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1190? permanent; }
if ($args ~* ^profile=829$){ rewrite ^/post/contact-us$ /post/contact-us_profile-829? permanent; }
if ($args ~* ^profile=823$){ rewrite ^/post/contact-us$ /post/contact-us_profile-823? permanent; }
if ($args ~* ^profile=821$){ rewrite ^/post/contact-us$ /post/contact-us_profile-821? permanent; }
if ($args ~* ^profile=962$){ rewrite ^/post/contact-us$ /post/contact-us_profile-962? permanent; }
if ($args ~* ^profile=830$){ rewrite ^/post/contact-us$ /post/contact-us_profile-830? permanent; }
if ($args ~* ^profile=847$){ rewrite ^/post/contact-us$ /post/contact-us_profile-847? permanent; }
if ($args ~* ^profile=1191$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1191? permanent; }
if ($args ~* ^profile=996$){ rewrite ^/post/contact-us$ /post/contact-us_profile-996? permanent; }
if ($args ~* ^profile=834$){ rewrite ^/post/contact-us$ /post/contact-us_profile-834? permanent; }
if ($args ~* ^profile=849$){ rewrite ^/post/contact-us$ /post/contact-us_profile-849? permanent; }
if ($args ~* ^profile=825$){ rewrite ^/post/contact-us$ /post/contact-us_profile-825? permanent; }
if ($args ~* ^profile=844$){ rewrite ^/post/contact-us$ /post/contact-us_profile-844? permanent; }
if ($args ~* ^profile=942$){ rewrite ^/post/contact-us$ /post/contact-us_profile-942? permanent; }
if ($args ~* ^profile=766$){ rewrite ^/post/contact-us$ /post/contact-us_profile-766? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/B$ /taxonomy/term/150/B_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/C$ /taxonomy/term/150/C_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/D$ /taxonomy/term/150/D_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/F$ /taxonomy/term/150/F_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/H$ /taxonomy/term/150/H_page-1? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/O$ /taxonomy/term/150/O_keys? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/K$ /taxonomy/term/150/K_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/M$ /taxonomy/term/150/M_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/N$ /taxonomy/term/150/N_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/P$ /taxonomy/term/150/P_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/R$ /taxonomy/term/150/R_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/S$ /taxonomy/term/150/S_page-1? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/W$ /taxonomy/term/150/W_page-1? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/142/D$ /taxonomy/term/142/D_keys? permanent; }
if ($args ~* ^profile=767$){ rewrite ^/post/contact-us$ /post/contact-us_profile-767? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/taxonomy/term/150/O$ /taxonomy/term/150/O_page-1-keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/V$ /taxonomy/term/150/V_keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/Z$ /taxonomy/term/150/Z_keys? permanent; }
if ($args ~* ^profile=960$){ rewrite ^/post/contact-us$ /post/contact-us_profile-960? permanent; }
if ($args ~* ^profile=1007$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1007? permanent; }
if ($args ~* ^profile=842$){ rewrite ^/post/contact-us$ /post/contact-us_profile-842? permanent; }
if ($args ~* ^profile=837$){ rewrite ^/post/contact-us$ /post/contact-us_profile-837? permanent; }
if ($args ~* ^page=1$){ rewrite ^/taxonomy/term/150/O$ /taxonomy/term/150/O_page-1? permanent; }
if ($args ~* ^profile=822$){ rewrite ^/post/contact-us$ /post/contact-us_profile-822? permanent; }
if ($args ~* ^profile=1005$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1005? permanent; }
if ($args ~* ^profile=1006$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1006? permanent; }
if ($args ~* ^profile=826$){ rewrite ^/post/contact-us$ /post/contact-us_profile-826? permanent; }
if ($args ~* ^profile=824$){ rewrite ^/post/contact-us$ /post/contact-us_profile-824? permanent; }
if ($args ~* ^profile=787$){ rewrite ^/post/contact-us$ /post/contact-us_profile-787? permanent; }
rewrite ^/&$ /-? permanent;
if ($args ~* ^profile=default$){ rewrite ^/install\.php$ /install_profile-default? permanent; }
if ($args ~* ^page=1$){ rewrite ^/news$ /news_page-1? permanent; }
if ($args ~* ^profile=1194$){ rewrite ^/post/contact-us$ /post/contact-us_profile-1194? permanent; }
if ($args ~* ^profile=788$){ rewrite ^/post/contact-us$ /post/contact-us_profile-788? permanent; }
if ($args ~* ^profile=851$){ rewrite ^/post/contact-us$ /post/contact-us_profile-851? permanent; }
if ($args ~* ^profile=957$){ rewrite ^/post/contact-us$ /post/contact-us_profile-957? permanent; }
if ($args ~* ^keys=$){ rewrite ^/staff$ /staff_keys? permanent; }
if ($args ~* ^page=1&keys=$){ rewrite ^/staff$ /staff_page-1-keys? permanent; }
if ($args ~* ^keys=$){ rewrite ^/taxonomy/term/150/c$ /taxonomy/term/150/c_keys? permanent; }
if ($args ~* ^op=info$){ rewrite ^/update\.php$ /update_op-info? 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
