# Redirect 400,401,403,404,500 to main website
error_page 400 401 403 404 500 https://norwoodmustangs.com

# Add a trailing slash (/) to a URL
rewrite ^([^.]*[^/])$ $1/ permanent;

# Specific redirections
rewrite ^/index\.php/category/announcements$ /index_php/category/announcements/? permanent;
rewrite ^/index\.php/author/jlongley$ /index_php/author/jlongley/? permanent;
rewrite ^/index\.php/2023/08/11/fall-sports-practice-tryout-schedule-2$ /index_php/2023/08/11/fall-sports-practice-tryout-schedule-2/? permanent;
rewrite ^/index\.php/2023/06/20/2023-cms-fall-sports-information$ /index_php/2023/06/20/2023-cms-fall-sports-information/? permanent;
rewrite ^/index\.php/2023/06/06/nhs-fall-sports-information-2023$ /index_php/2023/06/06/nhs-fall-sports-information-2023/? permanent;
rewrite ^/index\.php/2023/06/01/nhs-athletics-orientation-monday-6-5-6pm$ /index_php/2023/06/01/nhs-athletics-orientation-monday-6-5-6pm/? permanent;
rewrite ^/index\.php/2023/05/25/spring-sports-awards-night-2$ /index_php/2023/05/25/spring-sports-awards-night-2/? permanent;
rewrite ^/index\.php/2023/03/14/spring-sports-coaches-directory$ /index_php/2023/03/14/spring-sports-coaches-directory/? permanent;
rewrite ^/index\.php/2023/03/08/winter-sports-awards-night$ /index_php/2023/03/08/winter-sports-awards-night/? permanent;
rewrite ^/index\.php/2023/02/17/spring-sports$ /index_php/2023/02/17/spring-sports/? permanent;
rewrite ^/index\.php/2022/11/22/winter-sports-try-out-schedule-coaches-directory$ /index_php/2022/11/22/winter-sports-try-out-schedule-coaches-directory/? permanent;
rewrite ^/index\.php/2022/10/26/winter-sports-information-3$ /index_php/2022/10/26/winter-sports-information-3/? permanent;
rewrite ^/index\.php/2022/08/12/fall-sports-practice-schedule-2022$ /index_php/2022/08/12/fall-sports-practice-schedule-2022/? permanent;
rewrite ^/index\.php/2022/05/18/fall-sports-info-athletic-orientation-meeting-tuesday-6-14-22$ /index_php/2022/05/18/fall-sports-info-athletic-orientation-meeting-tuesday-6-14-22/? permanent;
rewrite ^/index\.php/2022/03/18/spring-sports-practice-schedule-3-21-22$ /index_php/2022/03/18/spring-sports-practice-schedule-3-21-22/? permanent;
rewrite ^/index\.php/2022/02/15/spring-sports-information-2$ /index_php/2022/02/15/spring-sports-information-2/? permanent;
rewrite ^/index\.php/2021/11/24/winter-sports-practice-schedule-head-coaches-directory$ /index_php/2021/11/24/winter-sports-practice-schedule-head-coaches-directory/? permanent;
rewrite ^/index\.php/2021/10/29/winter-sports-information-2$ /index_php/2021/10/29/winter-sports-information-2/? permanent;
rewrite ^/index\.php/2021/08/12/fall-sports-practice-tryout-schedule$ /index_php/2021/08/12/fall-sports-practice-tryout-schedule/? permanent;
rewrite ^/index\.php/2021/06/03/fall-sports-meet-the-coaches-night-thursday-6-10-6pm$ /index_php/2021/06/03/fall-sports-meet-the-coaches-night-thursday-6-10-6pm/? permanent;
rewrite ^/index\.php/2021/04/21/spring-sports-practice-schedule-4-26-21$ /index_php/2021/04/21/spring-sports-practice-schedule-4-26-21/? permanent;
rewrite ^/index\.php/2021/04/01/spring-sports-update$ /index_php/2021/04/01/spring-sports-update/? permanent;
rewrite ^/index\.php/2021/03/09/fall-ii-update$ /index_php/2021/03/09/fall-ii-update/? permanent;
rewrite ^/index\.php/2021/02/19/fall-ii-practice-try-out-schedules$ /index_php/2021/02/19/fall-ii-practice-try-out-schedules/? permanent;
rewrite ^/index\.php/2021/02/08/fall-ii-registration-update$ /index_php/2021/02/08/fall-ii-registration-update/? permanent;
rewrite ^/index\.php/2021/01/07/winter-sports-update-2$ /index_php/2021/01/07/winter-sports-update-2/? permanent;
rewrite ^/index\.php/2020/12/11/winter-sports-practice-tryout-schedules$ /index_php/2020/12/11/winter-sports-practice-tryout-schedules/? permanent;
rewrite ^/index\.php/2020/12/01/winter-sports-information-and-head-coaches-directory$ /index_php/2020/12/01/winter-sports-information-and-head-coaches-directory/? permanent;
rewrite ^/index\.php/2020/11/17/winter-sports-update$ /index_php/2020/11/17/winter-sports-update/? permanent;
rewrite ^/index\.php/2020/10/22/the-34th-running-of-the-norwood-turkey-trot$ /index_php/2020/10/22/the-34th-running-of-the-norwood-turkey-trot/? permanent;
rewrite ^/index\.php/2020/09/16/fall-season-i-try-out-schedule-head-coaches-directory$ /index_php/2020/09/16/fall-season-i-try-out-schedule-head-coaches-directory/? permanent;
rewrite ^/index\.php/2020/08/31/return-to-play-plan-for-nhs-athletics$ /index_php/2020/08/31/return-to-play-plan-for-nhs-athletics/? permanent;
rewrite ^/index\.php/2020/07/27/strength-conditioning-clinic-info-and-permission-form$ /index_php/2020/07/27/strength-conditioning-clinic-info-and-permission-form/? permanent;
rewrite ^/index\.php/2020/07/23/fall-sports-postponed-until-9-14-20$ /index_php/2020/07/23/fall-sports-postponed-until-9-14-20/? permanent;
rewrite ^/index\.php/2020/06/15/fall-sports-information-2020$ /index_php/2020/06/15/fall-sports-information-2020/? permanent;
rewrite ^/index\.php/2019/02/21/winter-awards-night-spring-sports-information$ /index_php/2019/02/21/winter-awards-night-spring-sports-information/? permanent;
rewrite ^/index\.php/page/2$ /index_php/page/2/? permanent;
rewrite ^/index\.php/nhs-boosters$ /index_php/nhs-boosters/? permanent;
rewrite ^/index\.php/category/announcements/page/2$ /index_php/category/announcements/page/2/? permanent;
rewrite ^/index\.php/author/jlongley/page/2$ /index_php/author/jlongley/page/2/? 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
