This forces every visitor to the encrypted version of your site, even if they type or link to the plain http:// address.
Before you start
Make sure SSL is already active on the domain (it is, by default, through AutoSSL — see what an SSL certificate is) before adding this redirect, or visitors will be sent to a page that doesn't load.
Adding the redirect
|
|
|
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
| Using Cloudflare? If your domain's traffic passes through Cloudflare, set the SSL/TLS mode in the Cloudflare dashboard to Full or Full (strict) before adding this rule. On Flexible mode, Cloudflare talks to this server over plain HTTP, so the server always sees %{HTTPS} off and redirects forever — an endless redirect loop that never finishes loading. |
|
Redirect loop or site not loading after this? We'll take a look. Open a support ticket |
|
SEE ALSO Why does my SSL certificate show fewer than 365 days? How to tell if your site has been compromised |
|
SSL CERTIFICATES The padlock your customers look for. A paid certificate adds warranty and company validation — useful for online shops and any site taking payments or customer data. See SSL certificatesHosting already includes free SSL for everyday use |
- 0 Users Found This Useful





