• My brain is full, having read all the great articles on how to move a WP site. I tried the move this morning but I got confused and couldn’t finish. I could use feedback on how I think this should work.

    The site is moving from one hosting account to another. I was on old host management technology, and migrated all my non-WP sites to a new cPanel hosting account. I think, in the language of the help articles, that meant I was moving to a new server. In addition, the domain changed.

    I created a local FTP copy of the old site (i.e. wp-admin, etc.), along with an export of the old MySQL file.

    Via cPanel, I installed WP on the new site location, deleted all the files/folders created by the install, and then FTP uploaded all the files/folders from the old site. I also imported the old MySQL file data into the new MySQL file.

    Went to the config file to update the MySQL connection and got confused finding the new host name (had the id and password OK).

    My assumption is, that when I figure out what the sql host name is, the changes to the config file will create the database connection. True?

    I think there is another step I need to do; getting the domain name updated. If true, is that done in the MySQL file?

    I want to get this process figured out since I expect to do other moves.

    • This topic was modified 8 years, 5 months ago by tdcarp.
Viewing 10 replies - 16 through 25 (of 25 total)
  • Thread Starter tdcarp

    (@tdcarp)

    Thought of another way to try migrate the old site. The old domain was moved, but no content had been loaded yet, so I moved the files there which should eliminate the domain name issue in the db. Created the db and imported the old site data.

    Am getting the message “Error establishing a database connection” when navigating there. Checked the config file and all the db entries looked right. Even reset the user pswd just in case.

    Read a couple articles on this error in the WP environment. Everything seems to check out file. Could be a problem with my hosting service, but haven’t checked that yet.

    I noticed that the vanilla install of WP doesn’t have a config file, nor is there a need to set up the db before logging in for the first time. Can I delete the config and the db, let WP do the initial setup of each, and then import the old site db data?

    Thread Starter tdcarp

    (@tdcarp)

    Looks like success! Was able to install vanilla wp in the root on the new hosting account that has the domain used by the old wp site. Emptied the db tables and imported the db tables from the old site. This means the issue of domain in the db was eliminated.

    All the users, pages, and media appear to be there.

    I’ll now execute the process that changes the domain name BEFORE exporting the db. Create the new db, import that data, migrate the files, and update the config.php db connection.

    I’ve learned quite a bit. Thanks. Will post back the final, tested process.

    Thread Starter tdcarp

    (@tdcarp)

    The test was only partially successful. The active theme and its child data were gone (the appearance>theme showed the theme but said it had no data). Three other themes were completely gone (no icon or data). 2014, 2015, and 2016 were there.

    Media was there but all were pointing to the old url.

    Will run another test to make sure the settings url change updates media urls.

    Thread Starter tdcarp

    (@tdcarp)

    Something still isn’t working. To simplify, I just changed the url in the WP settings, and then checked things like media links to make sure the change got propagated. Looks OK.

    I then restored the original site files (remember this is testing, so I didn’t just change the wp url settings back). I can navigate to and within the site, but can’t login to the wp admin area, getting these messages.

    Warning: Cannot modify header information – headers already sent by (output started at /home/wizardclown/public_html/wp_testsite/wp-content/themes/hashi/functions.php:627) in /home/wizardclown/public_html/wp_testsite/wp-login.php on line 402

    Warning: Cannot modify header information – headers already sent by (output started at /home/wizardclown/public_html/wp_testsite/wp-content/themes/hashi/functions.php:627) in /home/wizardclown/public_html/wp_testsite/wp-login.php on line 415

    I cleared browser cache, but no change. There are two non-wp files that are being restored along with the wp files: .ftpquota and .htaccess. I assume the ftpquota is being used by the host ftp service to manage any quota settings. Is the .htaccess file, restored along with all the wp files, causing an issue?

    I perform migrations like this from me testing URL’s to live URL’s once per week and there is never any problems with the basic transfer steps:

    1. Copy all PHP files across.
    2. Edit wp-config.php and change database settings
    3. Check htaccess for any URL redirects
    4. Export/Import database
    5. Change siteurl and home option values in wp_options

    This will work alone. I also then perform an update on all URL links in posts, pages and any custom URL menus and CSS images to make sure I am not linking people out to the old site and also do any tidy ups (some images need to be updated as well).

    Viola – that’s it.

    One common challenge is:

    If the root of your test site is: testdomain.com/subdirectory but on your live site it is domain.com/ – there will be more issues to deal with (all image URLs will be /subdirectory/wp-content/uploads/image.jpg and the new domain will be looking for subdirectory which doesn’t exist) but if it’s a straight swap – the above will work.

    Based on your error – I’m going to guess you had the test site on a subdirectoty?

    Thread Starter tdcarp

    (@tdcarp)

    Shannon, thanks again for sticking with me on this.

    I broke down the testing to isolate steps and reduce the variables. The last test was simply to check link addresses when I changed the wp setting url and then restore the site back to where it was before the setting change. I’m not actually trying to move the site yet.

    1. Bkup current files and export current db
    2. Changed the url setting in wp (just to see that it worked)
    3. Restored the bkup of the current files
    4. Dropped all the tables in the db and imported the current db backup

    The site is there and all the links seem to work (i.e. the db import and file restore worked). I just get the errors when I access the login.php file.

    I even rebooted my laptop, but the errors still remain.

    Yes, the test site is on a subdirectory (testdomain.net/wp_testsite) and the url change also went to a subdirectory (testdomain.net/wp-testsiteNEW), but again, all the files and db were restored to their original state. The test didn’t include the migration.

    I believe you that the migration steps are pretty straightforward, but this test is just a site restore.

    NOTE: If you change the URL in settings:

    The page will load BUT all the resources it requires (CSS, Images, JS) will be trying to load using the URL from settings.

    e.g. If you’re accessing testdomain.com/testsite and the url is set to domain.com, it is going to try and load all the resources from domain.com (which doesn’t exist) leading to errors

    Thread Starter tdcarp

    (@tdcarp)

    I’ve not done a good job of explaining the most recent test. The change of the wp url settings was there in the previous test just to take advantage of the opportunity to see how the url change effected the links. I’ve eliminated that step.

    The simple process being tested is the restore of a wp site, with no domain changes, and no changes in db.

    I have a good files backup and a good db export for the test site.

    This is the test:

    1. Delete all files from the remote site
    2. Drop all tables from the db
    3. FTP upload the files to the exact same directory
    4. Import the backup db

    I’ll post the results

    Thread Starter tdcarp

    (@tdcarp)

    Same errors when attempting to access login. Site looks fine.

    This is just a backup and restore without any changes.

    1. FTP entire site contents to local
    2. Export db
    3. Empty remote directory
    4. FTP entire site files to server
    5. Drop the db tables
    6. Import the site db backup

    • This reply was modified 8 years, 5 months ago by tdcarp.
    Thread Starter tdcarp

    (@tdcarp)

    May have found it!

    There’s some description of “cannot define header….” errors on the net. One of the issues is that the <?php can’t be proceeded by spaces, nor can ?> be followed by spaces. Somehow the active theme’s functions.php got two lines entered after the closing ?>. Removed them and the login works. Will reinstall the theme to check, but I expect the lines were introduced locally.

    Can now start testing the site migration.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Moving WP site to new server’ is closed to new replies.