How to redirect HTTP to HTTPS using .htaccess
Avatar image for Anthony Lee
Post by Anthony Lee · ⌨️ Code Snippets · first created 1 year ago
You can automatically redirect visitors to the secured (HTTPS) version of your site to make sure your communications are encrypted by using the following rules in a .htaccess file. ``` RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] ```