Michael B
Michael B

Reputation: 21

Forcing domain to load over HTTPS

I've recently installed on my website a CloudFlare SSL Certificate. However, when I am trying to force my website over HTTPS, I fail.

I firstly attempted to create a redirect from HTTP to HTTPS from my web host control panel (Hostinger), but apparently, you cannot create a redirect for the same website.

After this, I went to the .htaccess file and edited it, adding the following codes:

RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^.*$ https://www.domain.com%{REQUEST_URI} [R,L]

Error: The broswer does not redirects me to load the domain over HTTPS.

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Error: In Google Chrome I get the following error screen:

This webpage has a redirect loop

ERR_TOO_MANY_REDIRECTS

In Opera, the web page does not load.

I tried to delete my Chrome's cache, but it still didn't work.

Any tips?

Upvotes: 2

Views: 654

Answers (1)

Rstew
Rstew

Reputation: 605

You can utilise CloudFlare's page rules. Login to your account, head over to page rules. Click "Create Page Rule".

type in your domain name in the following format: http://example.com/* and add the setting

Always use HTTPS

Then press save and wait 30 seconds.

Upvotes: 1

Related Questions