Pregunta

I have to enforce https everytime when the sign-in site-node is loading. For example http://www.mysite.com/sign-in should always be enforced to https.

I tried multiple versions but none of them worked. It's the first time when I am using .htaccess

here is what i tried:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} sign-in
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [R,L]
¿Fue útil?

Solución

I solved it with :

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} /sign-in
RewriteRule !(.*)lbping(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Otros consejos

You shouldn't use %{REQUEST_URI} and $1 together in rewritten URL.

You can try this code:

RewriteCond %{HTTPS} off
RewriteRule sign-in https://%{HTTP_HOST}%{REQUEST_URI} [L,NC,R=301]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top