Erreur connexion SSL - Redirection https ne fonctionne pas
... / Redirection https ne fonc...
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

Redirection https ne fonctionne pas

Von
MichelD58
Erstellungsdatum 2020-10-21 21:44:43 (edited on 2024-09-04 13:04:31) in Erreur connexion SSL

Bonjour à tous, je vous explique le problème : j'ai un vps cloud avec 2 sites, j'ai installé un SSL gataway sur l'un des sites, j'ai fait la redirection dans le hhtpd vhost de mon wamp comme cela :
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^.*$ https://www.%1%{REQUEST_URI} [L,NE,R=301]

quand je vais sur le site en tapant monsite.fr il me redirige bien vers le https://www.monsite.fr mais quand je me connecte sur le site en tapant www.monsite.fr il reste sur ce dernier, en non sécurisé. Avez vous une idée ?
Cordialement, stéphane


4 Antworten ( Latest reply on 2020-10-21 22:35:39 Von
MichelD58
)

```text
RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]
```


RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]


merci, mais le problème reste le même

toi seul connais le domaine à tester

je peux le donner ce n'est pas un problème : cdss.fr

```text
RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]
```


RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]


merci mais toujours pas

```text tu n'es pas obligé de quoter à chaque fois pour rien en reprenant le totalité d'un message... surtout si erreur !

```text
curl --head -XGET --user-agent Firefox http://www.cdss.fr/
HTTP/1.1 200 OK (charset=UTF-8)

curl --head -XGET --user-agent Firefox https://www.cdss.fr/
HTTP/1.1 200 OK (charset=UTF-8)
```

les directives apache ne sont pas lues
directives mal placées?
ce que je donne doit être en tête et remplace les tiennes (et fonctionnent) ```

Je ne sais pas si elles sont mal placées mais voici l'intégralité de mon virtualhost (on ne voit pas les directory mais ils y sont):

ServerName cdss.fr


ServerAlias localhostar
DocumentRoot "${INSTALL_DIR}/www/"

Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted


RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

C'est bon c'était mon serveurallias qui était pourri, merci pour les bouts de codes et pour l'aide tardive, stéphane

Antworten sind derzeit für diese Frage deaktiviert.