Redirect to HTTPS via .htaccess

Htaccess configuration

Most websites today supports HTTPS. Everyone SHOULD use https for safety reasons, and having that https icon adds another level of trust from your visitors.

Apache only .htaccess

RewriteEngine On 
RewriteCond %{HTTPS}  !=on 
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

How to redirect to HTTPS using .htaccess behind Nginx Proxy

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *