Question

Migration failed badly - Redirect loop error (server)

  • Posted June 18, 2014

Hi guys,

I followed this guide in migrating WordPress (https://www.digitalocean.com/community/tutorials/how-to-migrate-wordpress-from-shared-hosting-to-a-cloud-server-with-zero-downtime) 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!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

For starters, I found this: <pre> curl reginaldchan.net -vvv

GET / HTTP/1.1 User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 Host: reginaldchan.net 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: http://www.reginaldchan.net/xmlrpc.php < Location: http://www.reginaldchan.net/ < Content-Length: 0 < Content-Type: text/html; charset=UTF-8 <

** server can’t find www.reginaldchan.net: NXDOMAIN </pre> It looks like when you set up DNS, you forgot to add the www CNAME to point to reginaldchan.net

Now, when I curl it and force the server, here’s what I get: <pre> curl -H “host: www.reginaldchan.net” 162.243.47.213/

<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href=“http://www.reginaldchan.net/”>here</a>.</p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at www.reginaldchan.net Port 80</address> </pre> Now, this tells me that your server is saying “I’m reginaldchan.net. You’re wanting www.reginaldchan.net.” Then the browser tries to go to www.reginaldchan.net, and it says “I’m reginaldchan.net. You’re wanting www.reginaldchan.net…” ad infintum.

Edit /etc/sites-enabled/(WHATEVER CONFIG YOU’RE USING) and add this line after <VirtualHost *:80> or <VirtualHost default:80>: <pre> ServerName reginaldchan.net Server Alias www.reginaldchan.net </pre> save the file, and run this: <pre> service apache2 reload </pre>

The domain I told you to contact me at. It’s Jon at that domain. shoot me an e-mail.

easy solution: <pre> tail -20 /var/log/apache2/reginaldchan.net-error.log </pre> It will tell you what’s wrong.

Here’s a vhost config for you:

http://curltools.com/vhost.conf

You can replace the ones you have with this one.

Replace all that with this (remove any spaces before > and after < ): <pre> ServerName yourdomain.com ServerAlias www.yourdomain.com DocumentRoot /var/www/ <Directory / > AllowOverride All </Directory> </pre>

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: <pre> select * from wp_options where option_name=‘siteurl’

±----------±------------±-------------------------±---------+ | option_id | option_name | option_value | autoload | ±----------±------------±-------------------------±---------+ | 1 | siteurl | http://YOUR_DOMAIN | yes | ±----------±------------±-------------------------±---------+ </pre> if it has an IP rather than a domain, run this: <pre> UPDATE wp_options SET option_value=‘http://YOUR_DOMAIN’ WHERE option_name=‘siteurl’; </pre> 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.