Probleme avec htaccess

Résolu
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!



--

2 réponses

  1. 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]

    --
    1. OK @+ bien content que tu ai trouvé la solution
  2. 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]
    1. Merci pour ta réponse elle m'a bien aidé.