Redirect HTTP to HTTPS

admin2025-06-05  3

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?

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?

Share Improve this question edited Oct 16, 2014 at 23:49 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Oct 15, 2014 at 9:51 SagarothSagaroth 254 bronze badges 4
  • I havent solution to my problem =/ Up :) – Sagaroth Commented Oct 21, 2014 at 19:11
  • The directions here about WordPress redirect loops might help (gleaned from other users that had the same issue). – damoncloudflare Commented Nov 4, 2014 at 18:55
  • This helped me, better explanations. – Janneby Commented Feb 9, 2017 at 10:09
  • This helped me, better explanations. – Janneby Commented Feb 9, 2017 at 10:12
Add a comment  | 

2 Answers 2

Reset to default 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.

Put this code in .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749073676a316126.html

最新回复(0)