Fix WordPress – Too Many Redirects error

Start Chatting Already [No Registration Required]

Enter The Chat

This will take you to the chat room you are looking for

Hello everyone, I would not like to do any formalities in this post because this website is not a tutorial hub. Its a chat website. We wanted to setup a blog for our website and so we chose WordPress however, we started facing a lot of issues such as Admin Login was failing and we were getting too many redirects error from the browser side and admin panel login form refreshed on submit. All of this was happening because WordPress was unable to cope with Https. If your WordPress Configuration doesn’t have this setting $_SERVER[‘HTTPS’] = ‘on’; then you will face the above and many more problems.

If you search about WordPress too many redirects error or How to make wordpress work with cloudflare ssl, you will end up getting low quality and unhelpful articles which will make you install plugins and stuff. So here’s the simple way.

This article contains three step by step guides:

  1. I show you how to migrate wordpress to https with 1 line of code
  2. How to fix broken images after https migration with 1 line of code
  3. If you have been locked out of your admin panel while trying to migrate to https, I will show you how to fix this with 2 lines of code.

How do I migrate wordpress from Http to Https

Note: I assume that you have already configured ssl on your domain. If not the fast, easy and free way to get SSL is [Add your website to], [Goto Crypto>Enable SSL]

Open WordPress admin panel and goto Settings>General and update WordPress Address (URL) and Site Address (URL) to Yes, update both the urls. If someone says to update only one of them, they are stupid.

You will be locked out of your admin panel after this step. Next step will fix this.

Open wp-config.php and add this line just below <?php

$_SERVER[‘HTTPS’] = ‘on’;

Done! No need to install any plugin.

My blog’s images are appearing broken

If your images are broken. Do the following:

  1. Open PhpMyAdmin
  2. Click on wordpress>wp_posts [Database and table name could be different for you]
  3. Goto SQL tab
  4. Type the query below and hit Go.

Update wp_posts set post_content = REPLACE(post_content,  ‘’, ‘’);

It’s as easy as that!

I have been locked out of admin panel

If you have been locked out of admin panel while changing WordPress Address (URL) to Https, do the following:

Method 1:

Add the following code to your wp-config.php file right below <?php


Method 2:

Login to PhpMyAdmin and update the urls in settings table of wordpress database. Do as shown in the image below.


1 thought on “Fix WordPress – Too Many Redirects error”

Leave a Reply

Your email address will not be published. Required fields are marked *