How to Point a Domain to Your Server: DNS Records Explained
Connect your domain to a VPS or hosting account with confidence. DNS record types in plain English, nameservers vs individual records, TTL and propagation, email records…
Moving hosts does not have to mean downtime or lost emails. A tested, step-by-step migration plan for WordPress and other sites, from inventory to DNS cutover.
A website migration sounds risky, and done in a hurry it can be. Done methodically, it is routine. The secret is simple: build and test the site on the new server while the old one keeps serving visitors, and only switch DNS when everything is confirmed working. This guide gives you that process, step by step, for shared hosting and VPS targets.
Before you copy anything, list what you are moving. Missed items cause most migration problems.
| Item | Where to find it | Notes |
|---|---|---|
| Website files | public_html or web root | Include hidden files like .htaccess |
| Databases | phpMyAdmin or MySQL | Note names, users and passwords |
| Email accounts | Mail settings in your panel | Mailboxes, forwarders, aliases |
| DNS records | Your DNS provider | A, AAAA, CNAME, MX, TXT (SPF, DKIM, DMARC) |
| Cron jobs | Panel or crontab | Scheduled tasks and their timing |
| SSL certificates | Panel or server | Free certificates can be reissued |
| PHP version and extensions | Panel or php -v | Match or test compatibility |
| Special settings | .htaccess, Nginx configs, php.ini | Redirects, upload limits, rewrites |
Pick a location close to your visitors and match the PHP version of the old host, or plan to test a newer version.
At least 24 hours before the planned switch, log into your DNS provider and lower the TTL on the A (and AAAA) records for your domain and www to a short value such as 300 seconds. Resolvers that cached the old, longer TTL will expire it within a day, so when you change the IP, most visitors pick up the new address within minutes.
If both hosts use cPanel, a full account backup can often be restored on the new server, carrying files, databases, email and settings in one step. Ask support whether they can assist with the restore.
rsync -avz user@old:/path/ /var/www/site/ copies directly between servers.mysqldump -u user -p dbname > site.sql, create a new database and user on the new host, then import with phpMyAdmin or mysql -u user -p newdb < site.sql.wp-config.php) with the new database name, user, password and host.Plugins that package the site and database into one archive simplify the process for WordPress. Check archive size limits and test the restore carefully.
This is the step that prevents downtime. Make your own computer see the new server while everyone else still sees the old one.
C:\Windows\System32\drivers\etc\hosts (open Notepad as administrator)/etc/hostsNEW_SERVER_IP example.com www.example.comFor sites with frequent changes, such as shops, forums or busy blogs, data added to the old server after your copy would be lost. To prevent this:
Our guide to pointing a domain to your server covers DNS records in detail.
If email is hosted separately (for example with a dedicated email provider), leave MX records unchanged.
Choose a low-traffic window for the final sync and DNS change. Check your analytics for the quietest hours, which are often late night in your main audience's time zone. Avoid migrating just before a product launch, a sale or a holiday when you might not be available to fix problems.
Give yourself a buffer. Plan the copy and testing for one day and the cutover for the next, so you are not rushing through tests late at night. If something looks wrong during testing, you can simply postpone the DNS change: visitors are still on the old server and nothing is lost.
| Symptom | Likely cause | Fix |
|---|---|---|
| "Error establishing a database connection" | Wrong DB credentials in config | Check name, user, password and host |
| Redirects to old domain or URL | Site URL stored in database | Update site URL settings; run a search-replace tool |
| Broken images | Missing uploads or hard-coded paths | Re-sync uploads; fix paths |
| 500 error | .htaccess rules or PHP version mismatch | Check error log; adjust PHP version |
| Mixed content warnings | HTTP links on HTTPS site | Update URLs to HTTPS |
| Emails not arriving | MX or SPF records not updated | Verify DNS records |
Moving to RexaHost? Choose shared hosting or a VPS, pay with crypto, and message support on Telegram @rexahost if you would like guidance during the move.
Copying a typical small site takes under an hour. The full process, including testing and DNS propagation, is best spread over a day or two to avoid rushing.
Not if you test on the new server first and switch DNS only when it is ready. Visitors are served by the old server until DNS updates.
TTL (time to live) tells resolvers how long to cache your DNS records. Lowering it a day before the move means the switch takes effect quickly.
Recreate mailboxes on the new host, switch MX records, then copy old messages with IMAP sync tools or by exporting and importing in your mail client.
No. Keep it running for at least a few days after the switch so you can recover anything missed and catch late DNS propagation.
Plans in this article
Keep reading
Connect your domain to a VPS or hosting account with confidence. DNS record types in plain English, nameservers vs individual records, TTL and propagation, email records…
A calm, practical runbook for the first hour of a DDoS attack: how to tell an attack from a traffic spike, what to send your host, which mitigations to apply and how to …
Hosting adverts love uptime percentages. Here is what 99.95% means in real minutes, the difference between a target and a contractual SLA, and how to measure availabilit…