Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Currently I asked my hosting provider to move my website from a windows server to a linux server. I'm trying to test if it works, but don't want to move the domain name just yet. I have to check if it works correctly. But when I try to login in wp-admin it redirects me to the old server. How can I change this?

The url reads something like "..?reauth=1".

share|improve this question
3  
    
I bet if you searched this site or googled it you would already have an answer. –  Andrew Bartel Nov 12 '13 at 18:46
    
Like @s_ha_dum states, you could copy the database over to a new machine. I often use a copy of a wp database on other machines, the two main thing you will need to replace are siteurl and home in you wp_options table. You could do something like this UPDATE wp_options SET option_value = 'http://yournewip.com' WHERE option_name IN ('home', 'siteurl'); where yournewip.com is the address to your new server. Note, that you will need to replace things in other tables for things like attachements and so on. –  Cyclone Nov 12 '13 at 20:43
    
This all seems to be the case, there is a new database setup on the new server, and also the wp-config reads the right urls. @Krister, at yournewip.com do you mean something like 192.168.0.1.com ?? is that possible? –  Remi Nov 12 '13 at 21:14
1  
@Remi - Yes, that would be possible if you're using the site locally (on your own local machine). Of course you could also use a valid domain name such as example.com if you have one. –  Cyclone Nov 13 '13 at 2:04

2 Answers 2

up vote 2 down vote accepted

I am assuming that you have both the Linux site and the (old) Windows site using the same database, and I am also assuming that the Linux server is operating currently on a numeric IP only until the migration. If that is the case, you do not want to alter the database at all-- not until you are ready for a proper migration. To test the Linux server using the "live" database, add a couple of constants to the wp-config.php file on the Linux server.

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

By doing that, the Linux server will operate somewhat independently of the Windows server, but without any database alterations.

Caveats:

This is really a "quick test" only solution. Be very careful who has access to the test server and be very careful what you do.

  1. "Static" resources like (most) images will still load from the Windows server but that is probably acceptable for testing purposes.
  2. If you add/update posts on the Linux server you will probably have to do a search and replace on the database after the migration, and may have oddball links on the Windows server during the transition. If you decide not to migrate you will likely have broken links. Be aware.

If you really want a thorough test, then lock out admin access on the Windows server to essentially freeze the database, copy the database for use with the Linux server, search and replace the copied database, and more or less migrate the site but use the IP address instead of the domain name.

share|improve this answer
    
First off, thank you for your thorough answer! As for point 1 you mention, that is the main reason we are transferring from the windows server hosting to linux, because we have some issues with uploading new images. Based on your answer, the best bet would be to just set the Linux server as the live one and fix all the oddball links after the transition... bummer –  Remi Nov 12 '13 at 21:18
    
For what it is worth, I never run on anything but Linux and have no complaints. –  s_ha_dum Nov 12 '13 at 22:13

In the database go to options table, and change the URLs field siteurl and home. You can use phpmyadmin or any mysql client.

share|improve this answer
    
You need to run a full find and replace on the database, and that's just one of the steps. –  Andrew Bartel Nov 12 '13 at 18:45
    
The wp-config.php file also has a constant that needs to be changed. It's also much more complicated if it's a WordPress Multisite installation. As @Howdy_McGee noted above, have a look at codex.wordpress.org/Moving_WordPress to start with. –  Pat J Nov 12 '13 at 19:10
    
@PatJ - It isn't that more complicated on a MU installation, only more tables to replace data in=) –  Cyclone Nov 12 '13 at 20:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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