Migrate WordPress to a New Domain Without Losing SEO Rankings
Learn how to change your WordPress domain: from backups and URL replacement to 301 redirects in .htaccess and essential post-migration checks.

On this page
Usually, a domain change happens due to a company name change, rebranding, or switching from one extension to another, for example from .it to .com. In all cases, it is a delicate but predictable operation if you follow the right order. Here is the complete roadmap, including the steps where people most often make mistakes.
Before you start #
Register the new domain and perform a full backup. You must buy the new domain first, and you shouldn’t let the old one expire. For your backup, you need the files (the entire site folder, especially wp-content) and the database. A backup that you have never tried to restore is not a real backup: if you use a plugin, download the archive to your computer instead of leaving it on the server.
Take a snapshot of the current situation. Export the list of indexed URLs from Search Console and note down the pages that drive the most traffic: you will need these for the final check.
Choose the right time. Pick a time when traffic is at its lowest, but never on a Friday evening: if something goes wrong, you want to have the following days to fix it.
Check that the new domain is clean. If it has had a previous life, it might carry some penalties. Check its history on archive.org and search for site:nuovodominio.it on Google: this helps you avoid surprises that are difficult to understand later.
Transferring files and databases #
The easiest way is using a migration plugin like Duplicator or All-in-One WP Migration, which creates a single package containing the files and database and restores it on the new installation. This works well for medium-sized sites; however, very large sites may run into server timeout limits or maximum size restrictions in free versions. If your site stays on the same hosting and only the domain changes, you often don’t need to move anything: just connect the new domain to the same space.
The manual method is more laborious but has no limits:
- Download all the site files via FTP (using FileZilla or Cyberduck) or through the file manager in your hosting control panel.
- Export the database in SQL format from phpMyAdmin or your hosting panel.
- Upload the files to the new web space.
- Create a new database and import the SQL file.
- Edit
wp-config.phpwith the database name, user, password, and host of the new installation.
hosts file on your computer, so you can ensure everything works correctly before moving your audience.Replacing URLs in the database #
The old domain appears in dozens of places within the database: internal links in articles, image paths, plugin settings, and custom fields. Changing the address in the settings alone won’t touch these.
Do not use a “find and replace” in phpMyAdmin. Some data is stored in a serialized format that includes the length of each text string: if you change the text without updating that number, the data becomes unreadable, and widgets or settings will disappear.
There are two correct tools for this:
A search and replace plugin that handles serialized data, such as Better Search Replace: run it in “dry run” mode first, then on the actual database.
WP-CLI, if you have command line access:
wp search-replace 'https://vecchiodominio.it' 'https://nuovodominio.it' --all-tables --dry-run--dry-runshows what would change without actually touching anything: run it this way to check the count, and only then run it for real.
After the replacement, go to Settings → General and verify that the WordPress Address (URL) and Site Address (URL) of WordPress point to the new domain using HTTPS. If you can no longer access your dashboard after the change, you can force them via wp-config.php, above the “That’s all, stop editing” line:
define( 'WP_HOME', 'https://nuovodominio.it' );
define( 'WP_SITEURL', 'https://nuovodominio.it' );

301 redirects: the decisive step #
The redirect must be set up on the old domain, in the .htaccess file in the root folder (this is a hidden file: enable “show hidden files” in your FTP client). If the server uses Apache, as most shared hosting does:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?vecchiodominio\.it$ [NC]
RewriteRule ^(.*)$ https://nuovodominio.it/$1 [R=301,L]
This rule sends every address to its corresponding page on the new domain while maintaining the path: vecchiodominio.it/articolo arrives at nuovodominio.it/articolo. Place it before any WordPress rules. If the server uses Nginx, you do the same thing with return 301 https://nuovodominio.it$request_uri; in the server block of the old domain; many hosting panels also have a built-in redirect option ready to go.

Three things that make all the difference:
- The code must be 301, not 302. A 302 indicates a temporary move and does not transfer page authority.
- The redirect must be page-by-page. Sending everything to the homepage is the mistake that causes the most damage: for search engines, it means all your old content no longer exists.
- Keep the old domain active for at least one year, or better yet, forever. This ensures redirects keep working while search engines update their index and as people click on old links scattered across the web.
If the URL structure changes between the old and new site, you will need specific rules for your main pages, which should be prepared beforehand using a table that maps each old URL to its new one.
After the migration #
Follow these steps in order, without skipping any:
- HTTPS Certificate on the new domain, and verify that the site only responds via HTTPS.
- Change of address in Search Console: add and verify the new property, then from the old property, go to Settings → Address Change and select the new one. The tool checks if your 301s are working, so do this only after they are active. If you use Bing Webmaster Tools, there is a similar function available there.
- Updated sitemap submitted from the new property.
- Check your robots.txt file: after a migration, it’s common to find yourself stuck with a total block left over from a testing environment.
- Internal links verified with a scanning tool: even after the database replacement, some might remain within themes or menus.
- Analytics: update your stream with the new domain in Google Analytics; otherwise, data tracking will stop for no apparent reason.
- Emails and services linked to the old domain: mailboxes, contact forms, and integrations with external services.
Ask for help from those who link to you #
Redirects transfer authority, but an updated link is worth more than a redirected one. Reach out to the sites that drive the most traffic to you (the top ten or twenty are enough) and ask them to update the URL. It’s an hour of work that pays off.
Also update everything you control directly: social media profiles, email signatures, business listings in directories, and printed materials if they are still in use.
FAQ #
How long should I keep the old domain active? #
At least twelve months, ideally twenty-four, and if you can, renew it forever: it costs very little and prevents someone else from buying it. Search engines update their index within a few weeks, but scattered links across the web, bookmarks, and references in documents remain for years.
Does a 301 redirect cause a loss of page authority? #
It used to be thought that there was a small loss. Today, Google states that a 301 transfers page value, provided that the destination has equivalent content. Damage occurs when you redirect everything to your homepage or to irrelevant pages.
Can I change my domain and URL structure at the same time? #
You can, but it’s better not to: if something goes wrong, you won’t know which of the two changes is to blame. The prudent approach is to change the domain, wait a few weeks for the situation to stabilize, and only then modify the structure.
What happens to emails from the old domain? #
Website redirects do not affect them; they only concern web traffic. Mailboxes must be moved separately; set up forwarding from the old ones to the new ones for an extended period and notify your regular contacts. You should also update the SPF, DKIM, and DMARC records for the new domain, otherwise your messages will end up in spam.
Is a migration plugin enough on its own? #
For moving the site, usually yes. However, it doesn’t cover the most important part: the redirects on the old domain and changing the address in Search Console. You have to do those two steps manually.
Do images and internal links update automatically? #
No. By changing the address in your settings, links and images embedded within articles will continue to point to the old domain. They will work as long as the redirect is active, but every click requires an extra step: this is why you need to perform a search and replace in the database.

