Move a Wordpress Website Manually
Jump to navigation Jump to search

Manually moving a Wordpress Website to another server or another directory consists several similar steps. All of the below assumes your server has the same services running like Apache, PHP, MariaDB / mySQL, etc.


If moving to a different database server or changing the name of a database (for consistency or whatever);

Export the Database: Using phpMyAdmin, Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.

Create a New Database: Use the following commands;

  • mysql -u WhatEverUserName -p
  • ...then press enter and type in the database password
  • CREATE DATABASE WhatEverDatabaseName;
  • GRANT ALL ON WhatEverDatabaseName.* TO 'WhatEverUserName'@'localhost' IDENTIFIED BY 'WhatEverPassword';

...notice the semi-colon at the end of the above commands

Import the Database: Using phpMyAdmin, Select the database in the left pane, Import Tab, Browse Button to locate the exported file, Go Button (then wait). Possible issues can occur here if different PHP time variables aren't set correctly. Importing can also be done from the command line. Just noting that here, it's simple to solve, but not addressed here, so don't worry or get frustrated, just Google the error. Afterall, the original database still exists, so you haven't messed anything up.

If needed, also modify the database name in wp-config.php: define('DB_NAME', 'WhatEverDatabaseName');

Copy the Files and set / check Permissions

  • If moving the website to a different server: Make a copy of the Website Files;
    • tar -cvzf /WhatEverDestinationFileName.tar.gz /WhatEverPathToSource/*
    • De-Compress: gunzip WhatEverFileName.tar.gz, tar xf WhatEverFileName.tar
    • Copy the 'Zipped File' using one of the below methods
      • If Samba is set up, use Windows Explorer
      • rsync -vP WhatEverFileName UserName@URLorIPAddress:/WhatEverPath (rsync -vP switch is "verbose" and "progress meter")
    • Note: The .htaccess file can present a bit of an issue when "tarring", so check it and copy manually if needed.


  • If moving to a different directory (it is assumed the root directory is /var/www/html, modifiy to suit your location);
    • cp -ax WhatEverSourceDirectory WhatEverDesitnationDirectory
  • Check or Correct Permissions and Ownership
    • chown -R apache:apache WhatEverDirectoryName
    • find WhatEverDirectoryName -type d -exec chmod 755 {} \;
    • find WhatEverDirectoryName -type f -exec chmod 644 {} \;

Web Server Configuration Apache, NGINX, etc. and DNS

Modify directory path names if needed.

Modify log file path names if needed.

DNS: Make sure DNS records reflect any name changes.


If making any changes to the name of the website, like to, then modify the following;

  • wp-config.php: $web_site = '';
  • Database: wp_options, siteurl and home, set to correct name if needed

SSL (really TLS), Certificates, etc.

  • 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.


If any custom redirect files are used (redirect.html, redirect.php) to redirect HTTP to HTTPS, modify them.