# Redirect non-www to www

# Specific redirections
if ($args ~* ^idetab=13422$){ rewrite ^/en/politique$ /en/politique_idetab-13422? permanent; }
if ($args ~* ^idetab=13422$){ rewrite ^/fr/politique$ /fr/politique_idetab-13422? permanent; }
if ($args ~* ^idetab=13422&start_date=2022-11-26&end_date=2022-11-27$){ rewrite ^/fr/availibility$ /fr/availibility_idetab-13422-start_date-2022-11-26-end_date-2022-11-27? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/AED$ /setcurrency/AED_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/AUD$ /setcurrency/AUD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/CAD$ /setcurrency/CAD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/EUR$ /setcurrency/EUR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/GBP$ /setcurrency/GBP_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/MAD$ /setcurrency/MAD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/USD$ /setcurrency/USD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/ARS$ /setcurrency/ARS_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/AZN$ /setcurrency/AZN_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/BGN$ /setcurrency/BGN_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/BHD$ /setcurrency/BHD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/BRL$ /setcurrency/BRL_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/CHF$ /setcurrency/CHF_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/CLP$ /setcurrency/CLP_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/CNY$ /setcurrency/CNY_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/COP$ /setcurrency/COP_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/CZK$ /setcurrency/CZK_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/DKK$ /setcurrency/DKK_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/EGP$ /setcurrency/EGP_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/FJD$ /setcurrency/FJD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/GEL$ /setcurrency/GEL_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/HKD$ /setcurrency/HKD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/HUF$ /setcurrency/HUF_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/IDR$ /setcurrency/IDR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/ILS$ /setcurrency/ILS_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/INR$ /setcurrency/INR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/JOD$ /setcurrency/JOD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/JPY$ /setcurrency/JPY_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/KRW$ /setcurrency/KRW_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/KWD$ /setcurrency/KWD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/KZT$ /setcurrency/KZT_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/MDL$ /setcurrency/MDL_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/MXN$ /setcurrency/MXN_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/MYR$ /setcurrency/MYR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/NAD$ /setcurrency/NAD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/NOK$ /setcurrency/NOK_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/NZD$ /setcurrency/NZD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/OMR$ /setcurrency/OMR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/PLN$ /setcurrency/PLN_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/QAR$ /setcurrency/QAR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/RON$ /setcurrency/RON_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/RUB$ /setcurrency/RUB_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/SAR$ /setcurrency/SAR_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/SEK$ /setcurrency/SEK_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/SGD$ /setcurrency/SGD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/THB$ /setcurrency/THB_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/TND$ /setcurrency/TND_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/TRY$ /setcurrency/TRY_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/TWD$ /setcurrency/TWD_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/UAH$ /setcurrency/UAH_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/VND$ /setcurrency/VND_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/XOF$ /setcurrency/XOF_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/XPF$ /setcurrency/XPF_lang-fr? permanent; }
if ($args ~* ^lang=fr$){ rewrite ^/setcurrency/ZAR$ /setcurrency/ZAR_lang-fr? 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
