Migration failed badly - Redirect loop error (server)

Posted June 18, 2014 17.1k views
Hi guys, I followed this guide in migrating WordPress ( and everything went okay UNTIL the last part. After changing DNS and IP, I keep receiving error server redirect loop error. I tested with various browser and even clear cache, but still doesn't work. I am using www by the way. I'm out of ideas on where this problem lies. Do you mind to share your thoughts? Using Unbuntu 14.04 & LAMP. Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
6 answers
For starters, I found this:
curl -vvv
* About to connect() to port 80 (#0)
*   Trying connected
* Connected to ( port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/ zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host:
> Accept: */*
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 18 Jun 2014 15:55:54 GMT
< Server: Apache/2.4.7 (Ubuntu)
< X-Powered-By: PHP/5.5.9-1ubuntu4
< X-Pingback:
< Location:
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
* Connection #0 to host left intact
* Closing connection #0
Now, when I do a nslookup on, I get this:

** server can't find NXDOMAIN
It looks like when you set up DNS, you forgot to add the www CNAME to point to Now, when I curl it and force the server, here's what I get:
curl -H "host:"

<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="">here</a>.</p>
<address>Apache/2.4.7 (Ubuntu) Server at Port 80</address>
Now, this tells me that your server is saying "I'm You're wanting" Then the browser tries to go to, and it says "I'm You're wanting" ad infintum. Edit /etc/sites-enabled/(WHATEVER CONFIG YOU'RE USING) and add this line after <VirtualHost *:80> or <VirtualHost _default_:80>:
Server Alias
save the file, and run this:
service apache2 reload
  • Hey! Thanks for coming back. Really appreciate it. I am using this:
    <VirtualHost *:80>
         DocumentRoot /var/www/
    <VirtualHost *:80>
         Redirect permanent /
    Do I add the lines into both spots or just either one? Sorry! Just want to clarify :)
  • Had exactly this problem, your tips are spot on, helped me fix it quickly, thank you!

When you say "guys", I'm assuming you mean DO guys. I'm a customer, but this might help: are you familar with the database? If so, you might want to check if in the wp_options (or SOMETHING_options) table you don't have the siteurl set to the old IP:
select * from wp_options where option_name='siteurl'

| option_id | option_name | option_value             | autoload |
|         1 | siteurl     | http://YOUR_DOMAIN | yes      |
if it has an IP rather than a domain, run this:
UPDATE wp_options SET option_value='http://YOUR_DOMAIN' WHERE option_name='siteurl';
change YOUR_DOMAIN to your actual domain, of course. Also, you might want to make sure you ported over the .htaccess file. If you did, you will need to make sure AllowOverride is set to ALL in the Apache config.
  • Hi jon, Thanks for the reply. Just checked. Seems like mysql is okay. Here's the site: The error I receive: The webpage at has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Learn more about this problem. Error code: ERR_TOO_MANY_REDIRECTS Hmm! I'm so lost now :/
Replace all that with this (remove any spaces before > and after < ):
DocumentRoot /var/www/
<Directory / >
AllowOverride All
Here's a vhost config for you: You can replace the ones you have with this one.
  • Hi jon, Seriously, you really have patience with a newbie like me :) Thanks for the config. Now, I have added it up and no more redirect loop. However, a check on the site on a fresh browser shows empty white page. Database issue maybe? *Temporary, I have just reuse my old DNS back as I need to grab a quick nap. It's 2am and been trying to resolve this over 7 hours now. So, back in a few hours. Mean time, I am thinking the problem could lie in: 1. database 2. wp files Am I on the right track? Thanks! Talk to you soon.
  • Everybody starts off a newbie. Never known someone born with an RHCE.
easy solution:
tail -20 /var/log/apache2/
It will tell you what's wrong.
  • Hi jon, I'm back :) Now, the log is empty and thus, I believe no error is logged here (size also shows 0 kb). Google keep showing a blank page so, I have no idea what went wrong. Any suggestions on this? *Temporary, I'm redownloading & reuploading my wp files and as well as mysql. Just in case... **Edit: I have Site Sensor and it shows Socket Error. Not sure what this means and not sure if this info helps. Thanks!
The domain I told you to contact me at. It's Jon at that domain. shoot me an e-mail.