Routing traffic from one domain to another using DNS

I have two domain names, e.g. a.com and b.com. I am planning for a.com to point to b.com. In case people accidentally type in a.com, they will end up on b.com.

What is the best way to configure that?

Can it be done through DNS record settings

Thank you!

Use page rules.

Hi Judge,

I added a page rule as per the article:

a.com/* to https://b.com

But when I tried connecting to a.com I get:

This site can’t be reached

a.com ’s server IP address could not be found.

Try:

ERR_NAME_NOT_RESOLVED

Do I need to set anything else up? At the moment, the DNS for a.com is completely empty.

You do still need a DNS record. You should set up an A record with the name @ (the domain itself) pointing to 192.0.2.1 (this is a bogus IP nobody owns), along with another A record but with the name www set to the same IP.

You are a champion, @Judge. That works.

I have another quick question, Judge. Is there a way for me to pop-up a message to say that they have misspelled the domain name, a.com but for next time please type b.com. How can I alert users that? because currently it’s just being redirected to b.com without them knowing it’s wrong.

You could redirect with a query string or to a different page (eg b.com/mistyped or b.com/?mistyped=yes) but this would require you either having a pop-up that checks for the ?mistyped=yes query string, or setting up a different page for the mistyped indicator.