My new cloned site when accessed by IP in a browser forwards back to the original site via a '301 Moved Permanently'. How do I keep this new site from forwarding back to the old?

History: Our dedicated webserver is dying, and I am attempting to get working clones of our wordpress websites working elsewhere before it is dead. I am new at this and wanted to have the security of seeing them running in a new linode VM before I switched the DNS over.

  • I set up the VM with Ubuntu Server 12.04, wordpress & LAMP
  • I copied over all the webfiles from the dedicated server(DS) to the Virtual Machine(VM)
  • I ran mysqldump on the DS and reinstalled the wordpress database on the VM
  • I made sure that the DB_user and DB_password in wpconfig.php had permissions to the DB
  • I made sure that the Apache virtual host files ( that I copied from the DS) has the IP of new vm.

Then the forwarding began, I have researched and tried the following

  • I added both of the following to my wpconfig.php file. I tried it by IP and by an alternate name

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

  • I and others have gone through the code looking for any typical forwarding code
  • I tried turning off rewriteengine in .htaccess
Apache is working as I can access static files via http://<ip>/image.png, but when I enter the IP in a browser, it pauses for a second and forwards back to the original site on the old DS. I am not convinced that wordpress is working correctly on the new site as it always forwards.

We get this 301 Moved Permanently when accessing it with curl

curl -v http://<ip>/
* About to connect() to <ip> port 80 (#0)
*   Trying <ip>...
* Adding handle: conn: 0x7fb182003a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fb182003a00) send_pipe: 1, recv_pipe: 0
* Connected to <ip> (<ip>) port 80 (#0)

GET / HTTP/1.1
User-Agent: curl/7.30.0
Host: <ip>
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Thu, 27 Feb 2014 13:34:33 GMT
* Server Apache/2.2.22 (Ubuntu) is not blacklisted
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.9
< X-Pingback: http://<orginal_domain_name>.org/xmlrpc.php
< Location: http://<orginal_domain_name>.org/
< Vary: Accept-Encoding
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
* Connection #0 to host <ip> left intact

How do I keep this new site from forwarding back to the old?

  • Your curl output seems to be missing something. Commented Mar 3, 2014 at 0:11
  • @MichaelHampton Sorry, I had edited it out. Added it back in
    – wruckie
    Commented Mar 3, 2014 at 2:41
  • I think your issue is in WordPress rather than the server configuration. The redirect is clearly coming from WP, rather than Apache. Commented Mar 3, 2014 at 4:02

1 Answer 1


When working with this dev site, i did not want to give it its own domain name, it was to replace the existing server as soon as i had it running.

It came down to two things. I had tried an IP here, but had forgotten to include the http://.

define( 'WP_SITEURL', 'http://123.456.789.255' );
define( 'WP_HOME', 'http://123.456.789.255' );

instead of

define( 'WP_SITEURL', '123.456.789.255' );
define( 'WP_HOME', '123.456.789.255' );

And the other thing was counter intuitive. I learned that 301 redirects are cached in the browser. So many of my setting changes were not even tested because the browser had cached the 301 it got on my first attempt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.