Redirection 301 HTACCESS http www => https

Voici un code à mettre dans le fichier .htaccess pour rediriger vers la bonne URL
Ne dispense pas de certificat SSL

####### START REDIRIGER TOUT VERS HTTPS SANS WWW

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

####### END REDIRIGER TOUT VERS HTTPS SANS WWW


OU BIEN :////////////////////////////////////////////////////////////////////////////////////


####### START REDIRIGER TOUT VERS HTTPS AVEC WWW

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

####### END REDIRIGER TOUT VERS HTTPS AVEC WWW

Publications similaires