Quick solution to move website on new host and keep email on old host
Do you want to move your website to a new host, but keep email on the old server ? I am not a DNS settings expert, but this solution worked for me to move the website from a cPanel host to a new AWS LightSail instance, while keeping the email unchanged and working on the old host.
In cPanel, go to DNS / Zone Editor and edit your A record for the domain name:
If you cannot edit it in cPanel, like was my case:
you might have access to the WHMpanel where you can fully edit the DNS zone records. Your DNS records should look something like this:
Observation 1: In this screenshot, you might observe that mail record is an “A” record, while most of the times you will have a “CNAME” record that points to “yourdomain.com.”. See next heading, Potential Problem #1 and Solution, for an explanation on this.
Observation 2: You might want to use lower values for TTL while you are experimenting with the changes, so you will have less wait time / downtime until you get them right.
Observation 3: If you cannot edit your DNS records in any way, you can try moving your whole DNS service to a new one. You can quickly set up an AWS Route 53 Domain Name System web service, but beware that it is not a free service and not currently included in the free tier.
After changing A record, depending on the dns propagation time (minutes to few hours), your domain will start pointing from the new location.
Potential Problem #1 and Solution
After editing the A record, in most cases you’ll have trouble with the mail DNS record which might reference “CNAME yourdomain.com” instead of “A ip”. Now that we changed the yourdomain.com A record, without also editing the mail CNAME record, email will reference your new website host ip. To fix this, we need to change “mail CNAME yourdomain.com.” to “mail A <your old host ip>”, because you want to keep email pointing to the old server.
Potential Problem #2 and Solution
If your MX records point to a mail exchanger spam filter (like SpamExperts for example), your spam filter might be also configured to send emails further to your main domain name yourdomain.com, instead of mail.yourdomain.com. Since yourdomain.com is now pointing to a new ip that only hosts your websites, emails will remain in the incoming queue (without a clear reason why, at first look).
To fix this, you’ll need to identify where you can change the incoming emails destination. For SpamExpers, you can find thiss under Incoming / Domain settings.