Moving your WordPress website to a new server or domain can feel daunting. This guide walks you through each step in simple, clear language so you can migrate with confidence. You’ll learn how to back up your files and database, transfer them securely, update your configuration, and switch your DNS records without downtime. Plus, discover how a Premium Linux Web Hosting plan can streamline the entire process.

1. Connect via SSH to Your Old Server

SSH (Secure Shell) lets you securely access your server’s command line. On your computer, open a terminal and run:

ssh username@old-server.com

If your host uses a non-standard port, add -p, for example:

ssh username@old-server.com -p 2222

2. Back Up Your WordPress Files

  • In your site folder (often public_html), run:
    tar -cvzf wpfiles.tar.gz public_html

3. Transfer Files to the New Server

  • Use scp or rsync. Example:
    scp -P 2222 wpfiles.tar.gz username@new-server.com:/home/username/
  • You can also use SFTP if you prefer a graphical tool.

4. Back Up Your Database

  • Export your MySQL/MariaDB database:
    mysqldump -u dbuser -p dbname > wpdb.sql
  • Transfer the SQL file:
    scp -P 2222 wpdb.sql username@new-server.com:/home/username/

5. Extract Files on the New Server

  • SSH into the new server:
    ssh username@new-server.com -p 2222
  • Extract the archive:
    tar -xzvf wpfiles.tar.gz
  • Set ownership and permissions:
    chown -R username:www-data public_html
    find public_html -type f -exec chmod 644 {} \;
    find public_html -type d -exec chmod 755 {} \;

6. Create a New Database and Import Data

  • Log into MySQL:
    mysql -u root -p
  • Run these SQL commands:
    CREATE DATABASE newdb;
    CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'newpass';
    GRANT ALL PRIVILEGES ON newdb.* TO 'newuser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  • Import the backup:
    mysql -u newuser -p newdb < wpdb.sql

7. Update wp-config.php

Edit public_html/wp-config.php and update these lines:

define('DB_NAME', 'newdb');
define('DB_USER', 'newuser');
define('DB_PASSWORD', 'newpass');

8. Update Site URL (If You Changed Domain)

  • Using MySQL:
    mysql -u newuser -p newdb
    USE newdb;
    UPDATE wp_options 
      SET option_value = 'https://new-domain.com' 
      WHERE option_name IN ('siteurl','home');
    EXIT;
  • Or with WP-CLI:
    wp search-replace 'https://old-domain.com' 'https://new-domain.com' --allow-root

9. Test Your Site and Switch DNS

  • Test on the new server by editing your local /etc/hosts file.
  • When ready, update your domain’s DNS A record to the new server IP.
  • Wait up to 48 hours for DNS to propagate. Avoid content edits during this time.

10. Why Premium Linux Web Hosting Helps

  • SSD storage for fast file access
  • PHP 8.x with OPcache for faster page loads
  • SSH and WP-CLI access for command-line control
  • Free SSL and global CDN for security and speed
  • 24×7 expert support for troubleshooting

For a smooth migration and top performance, consider Premium Linux Web Hosting.

Conclusion

By following these steps, you can migrate your WordPress site with minimal downtime and maximum performance. Pair these practices with a premium Linux hosting plan to keep your site fast, secure, and reliable.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)