Probleme avec htaccess
Résolu
renard007
Messages postés
5
Date d'inscription
Statut
Membre
Dernière intervention
-
animostab Messages postés 2829 Date d'inscription Statut Membre Dernière intervention -
animostab Messages postés 2829 Date d'inscription Statut Membre Dernière intervention -
Bonjour à tous,
Je viens d'installer un certificat thawte. sur mon site MAIS j'ai un gros soucis :
Je veux que
http://mondomaine.com
http://www.mondomaine.com
soit redirigé automatiquement vers https://www.mondomaine.com
PAR CONTRE j'ai des sous-domaines
je veux que :
http://(n'importe quoi autre que www ou rien).mondomaine.com
Ne soit pas touché et ne passe pas en https.
Pouvez vous m'aidez Merci à tous.
Je fouille je teste mais ça marche pas!
Ordi bientôt prêt à voler à travers la pièce!
--
Je viens d'installer un certificat thawte. sur mon site MAIS j'ai un gros soucis :
Je veux que
http://mondomaine.com
http://www.mondomaine.com
soit redirigé automatiquement vers https://www.mondomaine.com
PAR CONTRE j'ai des sous-domaines
je veux que :
http://(n'importe quoi autre que www ou rien).mondomaine.com
Ne soit pas touché et ne passe pas en https.
Pouvez vous m'aidez Merci à tous.
Je fouille je teste mais ça marche pas!
Ordi bientôt prêt à voler à travers la pièce!
--
2 réponses
Salut essaie ca
RewriteEngine On
RewriteCond %{HTTP_HOST} ^tonsite.com$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^tonsite.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^tonsite.com$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^tonsite.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
renard007
Messages postés
5
Date d'inscription
Statut
Membre
Dernière intervention
Merci pour ta réponse elle m'a bien aidé.
Slt merci pour ta réponse elle m'a bien aidée mais la résolution n'était que partielle :
- en effet le certificat ne s'appliquant que sur le www ça renvoyait dans le cas de (rien du tout).mondomaine.com vers https:\mondomaine.com => certificat non valide....
- le http://www. ne renvoyait pas vers https://www.
Voici grâce à ta réponse la solution à mon problème :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mondomaine.com$
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^mondomaine.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
--
- en effet le certificat ne s'appliquant que sur le www ça renvoyait dans le cas de (rien du tout).mondomaine.com vers https:\mondomaine.com => certificat non valide....
- le http://www. ne renvoyait pas vers https://www.
Voici grâce à ta réponse la solution à mon problème :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mondomaine.com$
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^mondomaine.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
--