If you’ve lost access to your domain (or subdomain) for whatever reason, and now you want to migrate your site to a new address, the process is unfortunately not very straight forward, and this is why we have this guide for you.
Please make sure to perform these steps in the order they are listed here.
1. Update DNS
The first step is to add your DNS records to the new domain. Typically you only need to add
CNAME records for
sftp pointing to the hostname of your hosting server.
If you have sites hosted on other subdomains, don’t forget to add them as well.
2. Update the Web Server
You need to tell the web server that your domain name has changed, so that it will start serving your site on the new domain.
This can be done from your Virtualmin administration panel, if you have the access to do it. If you cannot see this option, contact our support team and they will be happy to have this done for you.
This is how it would look like if you have access to this option:
3. Take a Backup
Take a backup of your site and settings before you do tests, just in case…
4. Update Your WordPress URL
At the time of this writing, WordPress will not allow you to access the management dashboard using the new domain name. What will happen is that your browser will keep getting redirected to the old domain as you try to access the dashboard from an address like
To fix this, you have first to add a couple of lines to
wp-config.php. You can edit this file using Virtualmin’s file manager. Locate the file, right-click it and select
Edit. Then add these two lines:
Of course, replace
example.com with your new domain.
Once saved, you can now access the dashboard from an address like
Settings -> General and update the site’s address fields.
Now you can revert the change made in
Alternatively, you can update the site’s URL directly in the database via Virtualmin’s database management tool:
- Find the
wp_optionstable and click it.
- Locate the
homerows and change their
option_valueto the new domain name.
5. Use a Search and Replace to Update URLs
You face now the issue of having resources embedded on the sites’ pages still linked to the old domain. If you visit your site, you’ll see that images, videos, CSS styles, etc, will not be visible at the moment because WordPress usually stores the full URL of the resources, including the domain, in the database.
If you have the necessary expertise, you can use database queries to find and update all URLs in the database.
Alternatively, use a plugin like “Better Search & Replace” to replace the old domain and update permalinks and other URLs. Disclaimer: This plug-in was recommended by a search engine. Feel free to browse the WordPress Plugin catalogue for many other options.