Move a Wordpress Website

Wiki.TerraBase.info
Jump to navigation Jump to search

Moving a Wordpress Website to another server consists of the following several steps

  • Make a copy of the Database: Using phpMyAdmin, Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.
  • Make a copy of the Website Files: tar -cvzf /WhatEverDestinationFileName.tar.gz /WhatEverPathToSource/* (De-Compress: gunzip WhatEverFileName.tar.gz, tar xf WhatEverFileName.tar)
    • The .htaccess file presents a bit of an issue when "tarring", so copy it manually.
  • Move or copy the saved database and website files to another server: rsync -vP WhatEverFileName UserName@URLorIPAddress:/WhatEverPath (rsync -vP switch is "verbose" and "progress meter")
  • Check or Correct Permissions and Ownership
    • chown -R apache:apache WhatEverDirectoryName
    • find WhatEverFolderName -type d -exec chmod 755 {} \;
    • find WhatEverFolderName -type f -exec chmod 644 {} \;
  • If using Let's Encrypt SSL Certificates, move Certificates to the new server: /etc/letsencrypt/archive, live, renewal (there are symbolic links in the live directory): rsync -avzP /etc/letsencrypt/archive/ UserName@URLorIPAdddress:/etc/letsencrypt/archive/ (repeat for each directory, the "a" switch will preserve symbolic links, find . -type l -ls will display the symbolic links)
  • Change DNS Settings
  • Configure new Apache Configuration File
  • Configure any new directories necessary: Log Files for Apache, etc.
  • Upgrade WordPress or change PHP version if needed, the former recommended.
  • If any custom redirect files are used (redirect.html, redirect.php) to redirect HTTP to HTTPS, modify them

All of the above assumes the new server has the same services running like Apache, PHP, MariaDB / mySQL, etc.