How to Fix Redirect Loop Errors after Enabling SSL of Cloudflare
Last Updated: September 24, 2020 in Guides
Cloudflare is a reputed security and performance service with the Content Delivery Network (CDN) which is famed for website speed improvement. It also has a solution to control the number of visitors, prevent the DDoS attacks, and enhance your WordPress website security. Because of its advantages, more people are using Cloudflare.
However, after turning on SSL, one of Cloudflare’s services, some errors may happen sometimes. One of the most happened errors is Redirect Loop. In this post, we are going to solve this error, which means stop the Redirect Loop after enabling the SSL in Cloudflare.
Common Errors when Enable SSL of Cloudflare
When you enable the SSL of Cloudflare on your WordPress website, you may get some below issues:
- Your website is not safe or the notice that your SSL is invalid;
- Your WordPress site has Endless Redirect Loop;
- ERR_TOO_MANY_REDIRECTS
- The WordPress admin page has Redirect Loop;
Besides, you may get some other errors which we did not mention here. Because we are talking about the Redirect in this post, we just listed which ones relevant to it.
Solutions to fix Redirect Loop errors
There are loads of solutions to fix this error. You may search for them easily on Google. But, here are the easiest ways to do it. Let’s try these.
1. Change the SSL status
Go to your Cloudflare admin account and in the admin dashboard, change the SSL status from Full to Flexible in the SSL/TLS section.
That’s all. This is the simplest and fastest way but does not ensure that it works all the time. If the errors still exist on your site, move to another one.
2. Request WordPress to run on HTTPS
You can do this method in cPanel or FPT. I will give you steps to do in cPanel because it is more popular.
Login to your account on your hosting page which you use for your website. Choose cPanel option.
Click to File Manager in the cPanel dashboard.
In the list of the files shown on the screen, find wp-config.php
and open it.
Next, find this line of code in that file:
/*That’s all, stop editing! Happy blogging. */
Then, insert this code $_SERVER['HTTPS'] = 'on'
to the line before the above code like this:
$_SERVER['HTTPS'] = 'on'; /*That’s all, stop editing! Happy blogging. */
Save the file, and that’s done. Now, refresh your website and check if the errors disappear or not.
Final Words
We hope you can solve all the errors of Redirect Loop on your website with the above simple ways. Errors usually go away when you apply these ways. Otherwise, you may look for another one or leave us your comment.
If you want to learn more tricks and tips with Cloudflare, you should definitely read this tutorial on how to set up Cloudflare for better security and performance. Thanks for reading!