Migrating a WordPress website to a new domain or hosting can sometimes create frustrating issues like redirects, login errors, broken SSL, or Elementor getting stuck while loading. This guide gives you a complete step-by-step process — from taking backups to restoring, migrating, and fixing all common errors.
1. What to Do Before Migrating a WordPress Website?
Table of Contents
Before you start, always create a backup so you can restore if anything breaks.
Steps:
- Backup Website Files: Download all files from
public_html
(or WordPress folder) using File Manager or FTP. - Backup Database: In phpMyAdmin → Export → Quick → SQL file.
- Save Configurations: Copy your existing
wp-config.php
file.
2. How to Migrate WordPress to a New Domain or Hosting?
When moving your site to a new host or domain, follow these steps:
- Upload WordPress files into the new hosting
public_html
. - Create a new database in hosting.
- Import your old database using phpMyAdmin.
- Update
wp-config.php
with new database details:
define('DB_NAME', 'new_db');
define('DB_USER', 'new_user');
define('DB_PASSWORD', 'new_pass');
define('DB_HOST', 'localhost');
- In phpMyAdmin → table
wp_options
: update
siteurl → https://newdomain.com
home → https://newdomain.com
3. What to Do When the Site Redirects to the Old Domain?
If your site still points to the old domain after migration:
- Double-check
siteurl
andhome
in database. - Run a search and replace in SQL or plugin (Better Search Replace):
UPDATE wp_posts SET post_content = REPLACE(post_content,'olddomain.com','newdomain.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,'olddomain.com','newdomain.com');
UPDATE wp_options SET option_value = REPLACE(option_value,'olddomain.com','newdomain.com');
- Check
.htaccess
for redirect rules. - Clear all caches (hosting, plugins, Cloudflare).
4. How to Restore WordPress Backup?
If migration goes wrong, restore your backup:
- Delete corrupted files/database.
- Upload the backed-up files again.
- Import the saved database.
- Update
wp-config.php
if database name/user changed.
5. How to Fix Elementor Keeps Loading and Not Opening?
Elementor needs the REST API (/wp-json/...
) to work. If it keeps loading:
- Go to Settings → Permalinks → Save Changes (flush rewrite rules).
- Ensure
.htaccess
has WordPress default rules:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
- Update Elementor to the latest version.
- Clear cache (plugin + hosting).
- If issue persists → disable all plugins except Elementor → test → re-enable one by one.
6. What to Do When You Forget WordPress Login?
If you lose your WordPress login after migration:
- Find Username/Email: In phpMyAdmin →
wp_users
. - Reset Password: Edit
user_pass
field → enter new password → select MD5 encryption. - Create a New Admin User (SQL):
INSERT INTO wp_users (user_login, user_pass, user_email, user_registered)
VALUES ('newadmin', MD5('StrongPass123'), 'admin@newdomain.com', NOW());
INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES ((SELECT ID FROM wp_users WHERE user_login='newadmin'),
'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
7. How to Fix SSL / HTTPS Errors After Migration?
If some resources show ERR_SSL_PROTOCOL_ERROR
:
- Install SSL in your hosting panel.
- Set
siteurl
andhome
tohttps://
. - Use Really Simple SSL plugin (optional).
- Run search-replace for
http://
→https://
.
8. How to Prevent Issues in Future Migrations?
To avoid downtime and errors in the future:
✅ Always take backup of files + database.
✅ Update wp-config.php
properly.
✅ Update siteurl
and home
immediately.
✅ Run search-replace for old domain references.
✅ Save permalinks after migration (fixes REST API).
✅ Install SSL before making site live.
✅ Test Elementor editor and admin login before launch.
Final Thoughts
Migrating WordPress doesn’t have to be stressful. By following this step-by-step migration guide, you can handle backups, restores, redirects, login problems, SSL errors, and Elementor loading issues with ease.
Keeping a simple checklist ensures your website migration will always be smooth, secure, and error-free.