htaccess: Redirect all of your pages to be forced to use SSL

htaccess 19 ก.ย. 2017

Add this to your .htaccess file.

# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This should be placed directly after RewriteEngine on if you have no previous rewrites.



Just a middle-aged programmer, Can do many things but not the most.