WordPress redirect loop

My customer has a WordPress site that is somewhat complex.  The DB is over 1 GB, the folder tree is about 6 GB, and it runs about 80 plugins.  And it's a multi-site installation.

For some maintenance / development work, I'm trying to make a clone of the site.

On the same server as CoolSite.com I've set up TestingCoolSite.com.  I changed the wp-config.php file to the correct file path and domain name.  Though TestingCoolSite.com is not a registered name, HOSTS file entries both on the server and on the clients of those testing have it.

In the DB, I found some settings with this:
select * from wp_options where option_value like '%coolsite%' and length(option_value) < 150;

And corrected them with these:

update wp_options set option_value = 'http://testingcoolsite.com' where option_name = 'siteurl';
update wp_options set option_value = 'http://testingcoolsite.com' where option_value = 'http://coolsite.com';
 update wp_options set option_value = replace(option_value, 'http://coolsite.com', 'http://testingcoolsite.com');


.htaccess, of course, does not mention the domain name:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress

some sites claim to have the definitive answer on breaking the redirect loop.  So I've added this to wp-config.php.

/* Fix redirect loop */
/* https://tommcfarlin.com/resolving-the-wordpress-multisite-redirect-loop/ */
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
/*Another attempt on the redirct loop ... */
/* https://trustiko.com/this-webpage-has-a-redirect-loop-wordpress-fix/ */
define ('WP_HOME', 'http://testingcoolsite.com');
define ('WP_SITEURL', 'http://testingcoolsite.com');


Of course, neither of those helped.

Some sites claim cookies are to blaim.  I tested using wget from a machine that had never visited the site.  I still get the redirect loop.

What else do I need to change?

Thanks!
LVL 32
Daniel WilsonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lucas BishopClick TrackerCommented:
Some of the plugins may have some settings that are conflicting. Do you have the loop no matter what page you visit?
Daniel WilsonAuthor Commented:
No page will come up.  At least, not the login page.

Another WP expert tells me which page to go to to try to fix it.  But I can't get any page.

wget http://testingcoolsite.com
--2015-07-29 08:43:53--  http://testingcoolsite.com/
Resolving testingcoolsite.com... 1.2.3.4
Connecting to testingcoolsite.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://testingcoolsite.com/wp-signup.php?new=testingcoolsite.com [following]
--2015-07-29 08:43:53--  http://testingcoolsite.com/wp-signup.php?new=testingcoolsite.com
Reusing existing connection to testingcoolsite.com:80.
HTTP request sent, awaiting response... 302 Found
Location: http://testingcoolsite.com/wp-signup.php?new=testingcoolsite.com [following]
--2015-07-29 08:43:53--  http://testingcoolsite.com/wp-signup.php?new=testingcoolsite.com
Reusing existing connection to testingcoolsite.com:80.

After 20 times, wget gives up.
Daniel WilsonAuthor Commented:
What table(s) should I look in to figure out which plugin is giving me trouble?
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Lucas BishopClick TrackerCommented:
First, any chance you have an htaccess rule that redirects non-www traffic to www sub domain? Or any other redirect rules?
Lucas BishopClick TrackerCommented:
I'd also review the DNS settings for the original domain and make sure they are replicated on your test server.
Daniel WilsonAuthor Commented:
I don't think there's a redirect, but the .htaccess file is in the original post.  Do you see anything messed up with that?

The live & test sites are on the same server.  the test domain name (represented as testcoolsite.com) is provided by an entry in /etc/hosts

Do you suppose something is actually doing a DNs lookup and skipping what's in hosts?
hieloCommented:
>> Do you suppose something is actually doing a DNS lookup and skipping what's in hosts?
Connect via telnet (you supply the IP to connect to; the hostname is used by the server to determine which site should handle the request in case the server hosts multiple sites). I think you'll find this useful:
http://www.the-art-of-web.com/system/telnet-http11/
Daniel WilsonAuthor Commented:
I have virtual hosts involved.  If I make an HTTP request to the IP address, I will get neither the live site nor the test site but some default.

The question does not involve connecting to a default Apache website.  The question does not involve figuring out whether my request is finding its way to the right server.  This isn't a routing issue or an Ubuntu issue.  I don't think it's an Apache issue.

The question is why the WordPress installation is looping with these 302 redirects.  Can you help me on this WordPress issue?

Thanks!
Lucas BishopClick TrackerCommented:
The reason I was asking about the DNS settings is because WMU has a unique configuration, so it can accommodate all of the sub-domains created in the MU environment. If you were to have these settings wrong, you could see weird conflicts in this scenario.

What you are describing seems to be a common issue with WMU. Specifically a redirect loop to wp-signup.php?new=domain.com in a WMU setup.

Does the same redirect take place when visiting the www. version of the site?
http://www.testingcoolsite.com
http://testingcoolsite.com 

Also, the steps you outlined above are perfect for migrating a basic WP site. However, with WMU, there are many more steps involved and the site url is contained in more tables than just wp_options.

If you haven't already, I'd run through this basic overview and see if you've missed any steps, before we begin trying to change anything:
http://premium.wpmudev.org/blog/move-multisite-new-domain/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Daniel WilsonAuthor Commented:
www.testingcoolsite.com goes to the default Apache site -- empty directory .

Thanks for those steps.  I'll check them out.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.