2

I was pleasantly surprised to see that CloudFlare had started providing a free SSL certificate to all its users, my site included.

I use a WordPress plugin to force HTTPS SSL on my pages, but the site is still accessible by HTTP, which leads to display issues. I want to force the native HTTP redirection to HTTPS in my .htaccess, but when I tried a redirect, I came across an infinite redirection loop.

How can I solve this?

0

I am answering this old question, as it still remains unanswered. Instead of using the plugin, you should use cPanel to redirect HTTP to HTTPS. It will help you to get rid of the infinite redirection loop issue. Follow these steps:

  1. Login to your cPanel account.
  2. Click on the File Manager.
  3. Ensure that public_html directory is being displayed. Scroll down and search for the .htaccess file. If you don't see the file, head to Settings at the top-right corner. Then check the box to show hidden files for document root.
  4. Next, a pop up box will appear. Click on the Edit button to confirm encoding.
  5. A new tab will show up. It will contain the codes of .htaccess. Copy and pasted this code to .htaccess file:

    RewriteEngineOn
    RewriteCond%{HTTPS}off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
  6. Finally, save the changes.

You can find more information about these steps here.

If you see mixed content and face trouble with the redirection, you will have to use Really Simple SSL plugin. It will fix the issue completely.

-1

Put this code in .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • 2
    Why? Please add an explanation to your answer. – fuxia Jan 6 '16 at 5:09
  • An answer without any form of eplanation is quite useless. Where should the code go, what does it do, how does it work. File an edit with these requirements – Pieter Goosen Jan 6 '16 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.