문제

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]
도움이 되었습니까?

해결책

I solved it with :

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

다른 팁

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]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top