Copying wordpress to another server breaks it on original server

I am working on a new version our site. Today I was going to put the blog on the new version.

Our current website and the successor I am building are on different servers and accessed by different domain names.

Read More

So what I did was import the database the blog uses into the dev site. Then I copied all the files and put them on the dev site. On the dev site I went to /blog/wp-admin and I changed the general settings so the blog URL would use the dev domain.

I made NO CHANGES on the current production website server. However the current production website’s blog is now broken. When I go to blog/wp-admin on the real site, the form posts to the dev server.

I am not able to log into wordpress on either the dev or production site now.

I do not understand how I could break anything on the production server by making changes on a completely separate server that is unrelated to the production server.

So my main goals now are to:

  1. Restore the blog on production
    server (undo the changes I made
    today) and get it working again
    right away.

  2. Figure out what I did wrong so I can
    put the blog on the production
    server.

Related posts

Leave a Reply

3 comments

  1. If you didn’t hand-change the wpurl in the dev database, what probably happened is that you entered your url, and WP made a 301 redirect to the live site. Then, without realizing it, you changed the url config in your live site.

    To make it work:

    Put this in your wp-config.php

    define('WP_SITEURL', 'http://your-wp-url.com');
    define('WP_HOME', 'http://your-wp-url.com'); 
    

    That should do it.

  2. After you moved the database to new hosting server, go to the wp_options table.

    see the row of that table. you can see this siteurl -> http://domain.com (old domain). change to new domain url.

    Go to the row number 37 with option_id = 37. Here you can see the home -> http://domain.com (old domain). change to new domain url.

    Now go to the site and see. Your site working!!!!!!

  3. When migrating you need to change all references of the previous domain in the database. I recommend using the migrate db plugin: http://wordpress.org/extend/plugins/wp-migrate-db/

    As well as Daniels Advice to modify the WP_SITEURL, WP_HOME constants.

    Then when you finally can login again. I recommend if you had permalinks turned on to turn them off and then on again. This will clear the .htaccess file and rewrite it to the correct settings.

    Finally. Please remember to backup your database before you migrate. You probably have already done that!