How to force SSL with .htaccess

Force https using .htaccess


If you want to force your entire website to go through https, you can add these rules to your .htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R=301,L]

If your site is in a subfolder, use this code:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://yourdomain.com/folder/$1 [R=301,L]



If you have a proxy in front of your server performing TLS termination:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


Comments

vaillracy said…
Casinos near me | The City Guides
There are currently no 순천 출장안마 casinos near me. Casino gambling is a serious and exciting 천안 출장마사지 activity in the 제천 출장안마 gambling world. You can play slots for free 청주 출장샵 on 유로 스타 사이트 our website or at