Redirect root level domain

Linode Staff

I wish to redirect the domain example.com to something.else.tld. Is this possible?

2 Replies

It looks like you want to redirect a root level domain to another site. I'll try to provide a few solutions and perhaps someone else wants to chime in as well! It's important to note the distinction between redirecting your domain to another URL vs pointing your domain or subdomain to a specific IP address or host.

DNS "Redirects"

I use "redirects" loosely as that isn't really what happens when using DNS. You can go to wikipedia or spend hours learning about DNS on google searches. I'll skip over that and get right to the point

When configuring a domain name, one of the first steps is to add the necessary DNS records to point to your host or server. This usually means setting up an A record for the root domain and a CNAME (or additional A records) for subdomains.

DNS is great for "redirects" that simply point the domain to a specific host, like website or application that has a dedicated IP address and is configured to work with the domain you want to use.

DNS is NOT great for redirecting a root domain to a different site. It wasn't designed for this and I don't believe it has the functionality. Some DNS hosts use custom tools that provide "URL Redirects" but most (from my understanding) are simply providing an easy interface for customers to hide what's really going on behind the scenes: using a web server or custom software to serve 301 or 302 redirects

If you need to use a DNS for pointing to a web application that doesn't provide a dedicated IP address (like Heroku), I belive you can use Cloudflare - which also as the benefit of DDoS protection.

Redirect a domain (301, 302)

If your goal is to just redirect the root domain to a different site, you can create a simple web server that serves 301 and 302 redirects. You can do this on Linode or any hosting provider that gives you a dedicated IP address. Each web server has a different way of accomplishing this. You'll then need to create an A record on your DNS pointing to the IP address of this web server.

I want to add on to Matt's last section about serving 301 and 302 redirects from your web server. Our Linode Docs repository has a guide for how to do this with Apache:

Redirect URLs with the Apache Web Server

NGINX also has a writeup for how to do this in their official docs. Specifically, you can use the return directive to accomplish this:

Creating NGINX Rewrite Rules

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct