# Redirect non-www to www

# Specific redirections
if ($args ~* ^id_appagebuilder_profiles=1$){ rewrite ^/$ /id_appagebuilder_profiles-1? permanent; }
if ($args ~* ^id_appagebuilder_profiles=2$){ rewrite ^/$ /id_appagebuilder_profiles-2? permanent; }
if ($args ~* ^id_appagebuilder_profiles=3$){ rewrite ^/$ /id_appagebuilder_profiles-3? permanent; }
if ($args ~* ^id_appagebuilder_profiles=4$){ rewrite ^/$ /id_appagebuilder_profiles-4? permanent; }
if ($args ~* ^id_appagebuilder_profiles=5$){ rewrite ^/$ /id_appagebuilder_profiles-5? permanent; }
if ($args ~* ^id_appagebuilder_profiles=6$){ rewrite ^/$ /id_appagebuilder_profiles-6? permanent; }
if ($args ~* ^id_appagebuilder_profiles=7$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-7? permanent; }
if ($args ~* ^id_appagebuilder_profiles=8$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-8? permanent; }
if ($args ~* ^id_appagebuilder_profiles=9$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-9? permanent; }
if ($args ~* ^id_appagebuilder_profiles=10$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-10? permanent; }
if ($args ~* ^id_appagebuilder_profiles=11$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-11? permanent; }
if ($args ~* ^id_appagebuilder_profiles=12$){ rewrite ^/index\.php$ /index_id_appagebuilder_profiles-12? permanent; }
if ($args ~* ^header=30$){ rewrite ^/index\.php$ /index_header-30? permanent; }
if ($args ~* ^header=34$){ rewrite ^/index\.php$ /index_header-34? permanent; }
if ($args ~* ^header=38$){ rewrite ^/index\.php$ /index_header-38? permanent; }
if ($args ~* ^header=42$){ rewrite ^/index\.php$ /index_header-42? permanent; }
if ($args ~* ^header=46$){ rewrite ^/index\.php$ /index_header-46? permanent; }
if ($args ~* ^header=50$){ rewrite ^/index\.php$ /index_header-50? permanent; }
if ($args ~* ^id_appagebuilder_profiles=1$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-1? permanent; }
if ($args ~* ^id_appagebuilder_profiles=2$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-2? permanent; }
if ($args ~* ^id_appagebuilder_profiles=3$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-3? permanent; }
if ($args ~* ^id_appagebuilder_profiles=4$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-4? permanent; }
if ($args ~* ^id_appagebuilder_profiles=5$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-5? permanent; }
if ($args ~* ^id_appagebuilder_profiles=6$){ rewrite ^/connexion$ /connexion/id_appagebuilder_profiles-6? permanent; }
if ($args ~* ^id_appagebuilder_profiles=1$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-1? permanent; }
if ($args ~* ^id_appagebuilder_profiles=2$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-2? permanent; }
if ($args ~* ^id_appagebuilder_profiles=3$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-3? permanent; }
if ($args ~* ^id_appagebuilder_profiles=4$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-4? permanent; }
if ($args ~* ^id_appagebuilder_profiles=5$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-5? permanent; }
if ($args ~* ^id_appagebuilder_profiles=6$){ rewrite ^/module/blockwishlist/mywishlist$ /module/blockwishlist/mywishlist/id_appagebuilder_profiles-6? permanent; }
if ($args ~* ^id_appagebuilder_profiles=7$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-7? permanent; }
if ($args ~* ^id_appagebuilder_profiles=8$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-8? permanent; }
if ($args ~* ^id_appagebuilder_profiles=9$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-9? permanent; }
if ($args ~* ^id_appagebuilder_profiles=10$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-10? permanent; }
if ($args ~* ^id_appagebuilder_profiles=11$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-11? permanent; }
if ($args ~* ^id_appagebuilder_profiles=12$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_id_appagebuilder_profiles-12? permanent; }
if ($args ~* ^header=30$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-30? permanent; }
if ($args ~* ^header=34$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-34? permanent; }
if ($args ~* ^header=38$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-38? permanent; }
if ($args ~* ^header=42$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-42? permanent; }
if ($args ~* ^header=46$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-46? permanent; }
if ($args ~* ^header=50$){ rewrite ^/module/blockwishlist/index\.php$ /module/blockwishlist/index_header-50? permanent; }
if ($args ~* ^id_appagebuilder_profiles=1$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-1? permanent; }
if ($args ~* ^id_appagebuilder_profiles=2$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-2? permanent; }
if ($args ~* ^id_appagebuilder_profiles=3$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-3? permanent; }
if ($args ~* ^id_appagebuilder_profiles=4$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-4? permanent; }
if ($args ~* ^id_appagebuilder_profiles=5$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-5? permanent; }
if ($args ~* ^id_appagebuilder_profiles=6$){ rewrite ^/comparaison-produits$ /comparaison-produits/id_appagebuilder_profiles-6? 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
