this webpage has a redirect loop

This Webpage has a Redirect Loop in WordPress: How to Fix the Problem

In WordPress by Fathi Arfaoui11 Comments

The redirect problem in any web browser is not easy to solve if you’re new to blogging, or if you set up a website for the first time. But, when you look inside the website configurations and some other things, you will easily fix the problem.

Today, I will show you how to fix the problem “This Webpage Has a Redirect Loop“, when you want to access your website homepage, or any other Url from Google Chrome, Firefox or any other browser.

The redirect loop problem appears, in general, when you migrate your website to a new server. And of course, you’ve missed something to add or to edit after moving your files.

In WordPress, for example, users forget to install their blog with the full domain name, if the old installation includes the “www”.

What does it mean “this webpage has a redirect loop”?

If you type the webpage URL that has the problem with Google Chrome, for example, you will notice an immediate message about the redirect issues as an error message. The same thing applies to Firefox, Safari and the other browsers, but with a different error message, such as, “too many redirects” and so on.

The problem is that you’ve many versions of the same URL address and they redirect the user to each other. As a result, no one of these URL will work, and the browser will work in a closed circle, and turn an error message to the visitor. The problem can be a result of broken htaccess file or a wrong code inserted there.

The second reason that can cause the problem is that you are using Google Page Speed for the website optimization, or any other service like CloudFlare or both of them. In this case, the Google cache is the problem and the problem is a URL conflict that sends the user to the Google cache, then to the server and vice versa without stopping,

That means that the Google Page Speed service cache is not updated with your latest server content, and even, if you’ve added your new IP to CloudFlare, Google cache is the problem. The fix is easy, you just need to delete the Google Page Speed cache and build the new one from the new server, follow the below steps,

Fixing the web page redirect problems

The below solutions depends on the nature of the problem and what causes the redirect errors. Just follow them one by one, or try the one that seems appropriate for your case.

1. Reset Permalinks

The first and easiest solution that can fix the problem is to reset the WordPress permalinks. All you have to do is to login into your WordPress admin area, click on “Settings”, then, click on “Permalinks”. The final step is to just click the “save changes” button, and WordPress will automatically regenerate a new htaccess file.

That will replace the old file that can be broken. If you need a step by step tutorial, you can read how to reset permalinks in WordPress.

2. Flush caches

If you’re using Google page speed service, you have to login and flash the content including images, and all the Html and CSS files, in your account. Click on “caching and errors” as the following screenshot.

This Webpage Has a Redirect Loop

 

Then, type your blog URL in the “flush caches” edit box with “*” at the end as the next example.

https://trustiko.com/*

Flush Caches

Now, click the “flush” button and wait some seconds until the process completes, then, visit your web page after clearing your browser cache or changing the browser to verify things, even more.

3. Set up the site URL

If you have made changes to your blog URL with, or without, the “www”, you need to define your URL in the blog directory. You can do that by logging into your cPanel account, click the “file manager”, and find the “wp-config.php” file, open it and add the next code at the end.

define('WP_HOME','http://www.yourdomain.com');
define('WP_SITEURL','http://www.yourdomain.com');

If you can’t find how to edit the file, you can read this post about changing the blog URL.

Fathi Arfaoui: A Physicist, Blogger, and the founder and owner of Trustiko.com. He shares Business, Blogging, WordPress, Web Safety, and Blogging tips to build better websites and blogs. Also, he shares online marketing strategies and recommendations.

Comments

  1. jorie

    I am having troubles with the redirect loop. I am going to follow your instructions in step 3, but wanted to double check. WordPress is not our homepage. do i need to put/blog after my domain? or just use
    define(‘WP_HOME’,’http://www.my domain.com’);
    define(‘WP_SITEURL’,’http://www.my domain.com’);
    thanks so much.

    1. Author
      Fathi Arfaoui

      Hi Jorie.
      You define the domain name for WordPress only, so, you need to add /blog at the end as you said. the file “wp-config.php” exist only in WordPress.
      I hope you fix the problem. If not, contact me and I’ll be happy to help. Good Luck.

  2. Sheila

    Thank you so much for these quick, thorough instructions! I had this very problem with the feedback loop, which I’ve never encountered before, but thanks to your easy-to-follow steps my client’s site is up and running again! Thank you so much 🙂

  3. chankirtan

    Saved the day for me! Thank you. I’d been having trouble with getting the add-on domain set up so that the url for it does not show that it’s routed through my main account. The url kept showing that the website in the add-on domain was a subdirectory of the main account. At last figured out to use RewriteBase /. The .htaccess file has a redirect in it to point all requests for www.mydomain.com to mydomain.com. So I was surprised when I got the redirect loop error, and it was just about too much after a difficult day. Luckily you shared a simple solution for the rest of us.

  4. speechbreeze

    Hi Fathi, I made a huge mistake in trying to update my site via WP Admin. I changed the site’s URL in Settings > General from http to https, now I get the constant redirect loop and am unable to get into my WP Admin entirely. Is there any way I can fix this?

  5. Gavin

    I had the same issue after an update. Turns out WooCommerce was to blame for the homepage redirect loop. My setup used https for the home URL and needed this update.

    2.4.13 – 11/01/2016
    Fix – Potential redirect loop when using ‘unforce ssl’ setting and a https home URL.

  6. Ben

    Genius! First point to “Save Changes” in permalinks worked a treat. I’d only spent about 8 hours trying to debug it…

  7. Admirer

    hey Fathi Arfaoui bless you a zillion times…. your suggestions worked perfectly man I did the permalinks refresh and it worked perfectly thanks a million

Leave a Comment