My main objetive is to redirect mydomain.com to lintr.ee/mydomain. I have my account at linktree all set up. I’ve already bought mydomain.com and set Godaddy’s Name Servers to look for Digitalocean’s DNS for directions. I’ve also used Digitalocean’s DNS to create a “CNAME” entry to redirect WWW to @. But now I’m stuck because an “A” entry will only let me specify an IP or a resource that I own on Digitalocean. What should I do? How do I redirect mydomain.com to my linktree link using Digitalocean DNS config?
PS: this is just a temporary redirect while I create my site
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
While you can use DNS to create an alias with a CNAME record (like making www.mydomain.com point to example.otherdomain.com), DNS by itself doesn’t handle HTTP redirects (like redirecting users who visit mydomain.com to lintr.ee/mydomain). You need a Droplet and a WebService like Apache or Nginx to do that.
Set up a DigitalOcean Droplet:
sudo apt update
sudo apt install nginx
Nginx Configuration:
sudo nano /etc/nginx/sites-available/default
Remove the current server block and replace with the following:
server {
listen 80;
server_name mydomain.com www.mydomain.com;
location / {
return 301 http://lintr.ee/mydomain;
}
}
Set A Record:
- In DigitalOcean's DNS management, set an "A" record for `mydomain.com` (and `www.mydomain.com` if desired) to point to the IP address of the droplet you just set up.
Finalize:
- Wait for DNS propagation. Depending on various factors, it may take anywhere from a few minutes to 48 hours (usually on the shorter side if it's a new domain).
- Now, when you visit `mydomain.com`, it should redirect to `lintr.ee/mydomain`.
Note on HTTPS: If you plan to use HTTPS for mydomain.com, you’ll need to set up a certificate (e.g., using Let’s Encrypt) and adjust the Nginx configuration accordingly.
While the above process requires maintaining a droplet, it gives you flexibility. Once you have your website ready, you can reconfigure the Nginx server to serve your website instead of redirecting to Linktree.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.