# Redirect non-www to www

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

# Specific redirections
if ($args ~* ^page=2$){ rewrite ^/wines$ /wines_page-2? permanent; }
if ($args ~* ^page=3$){ rewrite ^/wines$ /wines_page-3? permanent; }
rewrite ^/store/p1/2018_Belle_Glos_%27Clark_%26_Telephone%27_Pinot_Noir_-_Santa_Barbara%2C_California\.html$ /store/p1/2018_Belle_Glos_-Clark_-_Telephone-_Pinot_Noir_-_Santa_Barbara-_California? permanent;
rewrite ^/store/p10/2017_Canyon_Road_Chardonnay_-_Sonoma_County%2C_California\.html$ /store/p10/2017_Canyon_Road_Chardonnay_-_Sonoma_County-_California? permanent;
rewrite ^/store/p12/2015_August_Briggs_Dijon_Clones_Pinot_Noir_-_Sonoma_County%2C_California\.html$ /store/p12/2015_August_Briggs_Dijon_Clones_Pinot_Noir_-_Sonoma_County-_California? permanent;
rewrite ^/store/p13/2016_Domaine_Philippe_Goulley_Chablis_Premier_Cru_%27Montmains%27_-_France\.html$ /store/p13/2016_Domaine_Philippe_Goulley_Chablis_Premier_Cru_-Montmains-_-_France? permanent;
rewrite ^/store/p14/2018_Kenwood_Six_Ridges_Russian_River_Valley_Chardonnay_-_Sonoma_County%2C_California\.html$ /store/p14/2018_Kenwood_Six_Ridges_Russian_River_Valley_Chardonnay_-_Sonoma_County-_California? permanent;
rewrite ^/store/p15/2018_Villarini_Nero_d%E2%80%99Avola_Organic_-_Italy\.html$ /store/p15/2018_Villarini_Nero_d-Avola_Organic_-_Italy? permanent;
rewrite ^/store/p17/2018_Belle_Glos_%27Las_Alturas%27_Pinot_Noir_-_Monterey%2C_California\.html$ /store/p17/2018_Belle_Glos_-Las_Alturas-_Pinot_Noir_-_Monterey-_California? permanent;
rewrite ^/store/p19/2017_Murrieta%27s_Well_%27The_Whip%27_White_Wine_Blend_-_Livermore_Valley%2C_California\.html$ /store/p19/2017_Murrieta-s_Well_-The_Whip-_White_Wine_Blend_-_Livermore_Valley-_California? permanent;
rewrite ^/store/p2/2017_Vina_Robles_Estate_Cabernet_Sauvignon_-_Paso_Robles%2C_California\.html$ /store/p2/2017_Vina_Robles_Estate_Cabernet_Sauvignon_-_Paso_Robles-_California? permanent;
rewrite ^/store/p20/2016_Stag%27s_Leap_Merlot_-_Napa_Valley%2C_California\.html$ /store/p20/2016_Stag-s_Leap_Merlot_-_Napa_Valley-_California? permanent;
rewrite ^/store/p21/2016_Armeda_Winery_Poizin_Zinfandel_-_Sonoma%2C_California_\.html$ /store/p21/2016_Armeda_Winery_Poizin_Zinfandel_-_Sonoma-_California_? permanent;
rewrite ^/store/p22/2018_Oak_Farm_Sauvignon_Blanc_-_Lodi%2C_California\.html$ /store/p22/2018_Oak_Farm_Sauvignon_Blanc_-_Lodi-_California? permanent;
rewrite ^/store/p24/Stanford_Brut_Governer%27s_Cuvee\.html$ /store/p24/Stanford_Brut_Governer-s_Cuvee? permanent;
rewrite ^/store/p25/2018_Bella_Grace_Estate_Bella_Ros%C3%A9_-_Amador_County%2C_California\.html$ /store/p25/2018_Bella_Grace_Estate_Bella_Rosé_-_Amador_County-_California? permanent;
rewrite ^/store/p26/2017_Cycles_Gladiator_Petite_Sirah_-_Lodi%2C_California\.html$ /store/p26/2017_Cycles_Gladiator_Petite_Sirah_-_Lodi-_California? permanent;
rewrite ^/store/p27/2017_Orin_Swift_Machete_Red_Blend_-_Napa%2C_California\.html$ /store/p27/2017_Orin_Swift_Machete_Red_Blend_-_Napa-_California? permanent;
rewrite ^/store/p28/2016_Tooth_%26_Nail_The_Possessor_Red_Blend_-_Paso_Robles%2C_California\.html$ /store/p28/2016_Tooth_-_Nail_The_Possessor_Red_Blend_-_Paso_Robles-_California? permanent;
rewrite ^/store/p29/2016_Domaine_la_Garrigue_%22Cuv%C3%A9e_Romaine%22_C%C3%B4tes_du_Rh%C3%B4ne_-_France\.html$ /store/p29/2016_Domaine_la_Garrigue_-Cuvée_Romaine-_Côtes_du_Rhône_-_France? permanent;
rewrite ^/store/p3/2016_Rabble_Red_Blend_-_Paso_Robles%2C_California\.html$ /store/p3/2016_Rabble_Red_Blend_-_Paso_Robles-_California? permanent;
rewrite ^/store/p30/2015_Domaine_la_Garrigue_Vacqueyras_%22La_Cantarelle%22_-_France\.html$ /store/p30/2015_Domaine_la_Garrigue_Vacqueyras_-La_Cantarelle-_-_France? permanent;
rewrite ^/store/p32/2016_Dueling_Pistols_Dry_Creek_Valley_Red_Blend_-_Sonoma_County%2C_California\.html$ /store/p32/2016_Dueling_Pistols_Dry_Creek_Valley_Red_Blend_-_Sonoma_County-_California? permanent;
rewrite ^/store/p33/2017_DAOU_Vineyards_Bodyguard_-_Paso_Robles%2C_California\.html$ /store/p33/2017_DAOU_Vineyards_Bodyguard_-_Paso_Robles-_California? permanent;
rewrite ^/store/p36/2016_Rutherford_Hill_Barrel_Select_-_Napa_Valley%2C_California\.html$ /store/p36/2016_Rutherford_Hill_Barrel_Select_-_Napa_Valley-_California? permanent;
rewrite ^/store/p4/2017_Carpineto_Dogajolo_Toscano%2C_IGT_-_Italy\.html$ /store/p4/2017_Carpineto_Dogajolo_Toscano-_IGT_-_Italy? permanent;
rewrite ^/store/p5/2018_Mountain_Ranch_Winery_Grand_Reserve_Old_Vine_Barbera_-_Sierra_Foothills%2C_California\.html$ /store/p5/2018_Mountain_Ranch_Winery_Grand_Reserve_Old_Vine_Barbera_-_Sierra_Foothills-_California? permanent;
rewrite ^/store/p8/2016_Ch%C3%A2teau_de_Plaisance_%E2%80%9CEmbruns%E2%80%9D_Chenin_Blanc_Anjou_-_France\.html$ /store/p8/2016_Château_de_Plaisance_-Embruns-_Chenin_Blanc_Anjou_-_France? permanent;
rewrite ^/store/p9/2016_Penfolds_Max%27s_Cabernet_Sauvignon_-_South_Australia\.html$ /store/p9/2016_Penfolds_Max-s_Cabernet_Sauvignon_-_South_Australia? 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
