# Redirect non-www to www

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

# Specific redirections
if ($args ~* ^PID=1485$){ rewrite ^/custom\.asp$ /custom_PID-1485? permanent; }
if ($args ~* ^lightbox=dataItem-j2aw8s3y2$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-j2aw8s3y2? permanent; }
if ($args ~* ^lightbox=dataItem-j2aw8s3y3$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-j2aw8s3y3? permanent; }
if ($args ~* ^lightbox=dataItem-j2aw8s3z$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-j2aw8s3z? permanent; }
if ($args ~* ^lightbox=dataItem-j2aw8s3z1$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-j2aw8s3z1? permanent; }
if ($args ~* ^lightbox=dataItem-j2aw8s3z2$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-j2aw8s3z2? permanent; }
if ($args ~* ^lightbox=dataItem-jwcgu5q8$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-jwcgu5q8? permanent; }
if ($args ~* ^lightbox=dataItem-k753at8u$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-k753at8u? permanent; }
if ($args ~* ^lightbox=dataItem-k753pmtb$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-k753pmtb? permanent; }
if ($args ~* ^lightbox=dataItem-k753r7f4$){ rewrite ^/our-staff$ /our-staff_lightbox-dataItem-k753r7f4? permanent; }
if ($args ~* ^PID=14543$){ rewrite ^/promo\.asp$ /promo_PID-14543? permanent; }
if ($args ~* ^PID=9593$){ rewrite ^/promo\.asp$ /promo_PID-9593? permanent; }
if ($args ~* ^PID=9594$){ rewrite ^/promo\.asp$ /promo_PID-9594? permanent; }
if ($args ~* ^TID=5076&MID=165578$){ rewrite ^/services\.asp$ /services_TID-5076-MID-165578? permanent; }
if ($args ~* ^TID=5084&MID=165579$){ rewrite ^/services\.asp$ /services_TID-5084-MID-165579? permanent; }
if ($args ~* ^TID=5084&MID=165582$){ rewrite ^/services\.asp$ /services_TID-5084-MID-165582? permanent; }
if ($args ~* ^TID=5084&MID=165593$){ rewrite ^/services\.asp$ /services_TID-5084-MID-165593? permanent; }
if ($args ~* ^TID=5084&MID=165594$){ rewrite ^/services\.asp$ /services_TID-5084-MID-165594? permanent; }
if ($args ~* ^TID=5072&MID=79311$){ rewrite ^/services\.asp$ /services_TID-5072-MID-79311? permanent; }
if ($args ~* ^TID=5073&MID=79313$){ rewrite ^/services\.asp$ /services_TID-5073-MID-79313? permanent; }
if ($args ~* ^TID=5073&MID=79314$){ rewrite ^/services\.asp$ /services_TID-5073-MID-79314? permanent; }
if ($args ~* ^TID=5073&MID=79315$){ rewrite ^/services\.asp$ /services_TID-5073-MID-79315? permanent; }
if ($args ~* ^TID=5073&MID=79316$){ rewrite ^/services\.asp$ /services_TID-5073-MID-79316? permanent; }
if ($args ~* ^TID=5073&MID=79317$){ rewrite ^/services\.asp$ /services_TID-5073-MID-79317? permanent; }
if ($args ~* ^TID=5074&MID=79321$){ rewrite ^/services\.asp$ /services_TID-5074-MID-79321? permanent; }
if ($args ~* ^TID=5074&MID=79322$){ rewrite ^/services\.asp$ /services_TID-5074-MID-79322? permanent; }
if ($args ~* ^TID=5074&MID=79323$){ rewrite ^/services\.asp$ /services_TID-5074-MID-79323? permanent; }
if ($args ~* ^TID=5075&MID=79324$){ rewrite ^/services\.asp$ /services_TID-5075-MID-79324? permanent; }
if ($args ~* ^TID=5075&MID=79325$){ rewrite ^/services\.asp$ /services_TID-5075-MID-79325? permanent; }
if ($args ~* ^TID=5076&MID=79326$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79326? permanent; }
if ($args ~* ^TID=5076&MID=79327$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79327? permanent; }
if ($args ~* ^TID=5076&MID=79331$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79331? permanent; }
if ($args ~* ^TID=5076&MID=79332$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79332? permanent; }
if ($args ~* ^TID=5076&MID=79333$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79333? permanent; }
if ($args ~* ^TID=5076&MID=79335$){ rewrite ^/services\.asp$ /services_TID-5076-MID-79335? permanent; }
if ($args ~* ^TID=5077&MID=79338$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79338? permanent; }
if ($args ~* ^TID=5077&MID=79340$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79340? permanent; }
if ($args ~* ^TID=5077&MID=79341$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79341? permanent; }
if ($args ~* ^TID=5077&MID=79342$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79342? permanent; }
if ($args ~* ^TID=5077&MID=79343$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79343? permanent; }
if ($args ~* ^TID=5077&MID=79344$){ rewrite ^/services\.asp$ /services_TID-5077-MID-79344? permanent; }
if ($args ~* ^TID=5084&MID=79347$){ rewrite ^/services\.asp$ /services_TID-5084-MID-79347? permanent; }
if ($args ~* ^TID=5084&MID=79349$){ rewrite ^/services\.asp$ /services_TID-5084-MID-79349? permanent; }
if ($args ~* ^TID=5084&MID=79351$){ rewrite ^/services\.asp$ /services_TID-5084-MID-79351? permanent; }
if ($args ~* ^TID=5072$){ rewrite ^/services\.asp$ /services_TID-5072? permanent; }
if ($args ~* ^TID=5073$){ rewrite ^/services\.asp$ /services_TID-5073? permanent; }
if ($args ~* ^TID=5074$){ rewrite ^/services\.asp$ /services_TID-5074? permanent; }
if ($args ~* ^TID=5075$){ rewrite ^/services\.asp$ /services_TID-5075? permanent; }
if ($args ~* ^TID=5076$){ rewrite ^/services\.asp$ /services_TID-5076? permanent; }
if ($args ~* ^TID=5077$){ rewrite ^/services\.asp$ /services_TID-5077? permanent; }
if ($args ~* ^TID=5084$){ rewrite ^/services\.asp$ /services_TID-5084? permanent; }
if ($args ~* ^LID=$){ rewrite ^/staff\.asp$ /staff_LID? permanent; }
if ($args ~* ^todo=as_page;instance=4142815;num=12;community_id=2007991$){ rewrite ^/cgi-bin/snippet\.cgi$ /cgi-bin/snippet_todo-as_page-instance-4142815-num-12-community_id-2007991? 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
