The short answer

DNS answers one question: which address serves this name. It never sees the path, the https:// scheme or the rest of a URL, so it cannot send example.com/shop anywhere. A CNAME makes one name an alias of another, but the browser still shows and requests the original name. A redirect is an HTTP response (301, 302, 307 or 308) from a web server, which tells the browser to load a different URL. URL forwarding from a registrar or DNS provider is simply a redirect server they run: your DNS points at it, and it sends the redirect. For HTTPS to work, whichever server answers must have a valid certificate for the name the visitor typed.

Which tool does what

MechanismLayerCan change the path or scheme?What the visitor sees
A or AAAA recordDNSNoThe original URL; the server at that address answers
CNAME recordDNSNoThe original URL; the target's server answers, and must accept the original name
ALIAS, ANAME or CNAME flatteningDNS (provider feature)NoSame as a CNAME, but allowed at the zone apex
HTTP redirect (301, 308, 302, 307)HTTPYesThe browser moves to the new URL
Registrar or DNS provider "URL forwarding"HTTP, on the provider's serverYesThe browser moves to the new URL
"Masked" or "frame" forwardingHTML frame on the provider's serverNo, the old URL stays in the address barThe new site inside a frame. Often blocked by the target's framing rules, and bad for search and bookmarks.

Email forwarding is unrelated: it is set up with MX records and the mail provider, not with web redirects.

Why a CNAME is not a redirect

Suppose www.example.com is a CNAME to shops.example.net. The browser looks up the name, follows the CNAME to an address, connects, and asks that server for https://www.example.com/. The server sees www.example.com in the TLS handshake (SNI) and in the HTTP Host header. If it is not set up for that name, you get a certificate warning, a default page or an error, not the site at shops.example.net.

That is why hosting platforms ask you to "add a custom domain" as well as create the CNAME: the platform has to accept the name and get a certificate for it.

Apex and www

The zone apex (example.com) cannot hold a CNAME, because it must also hold SOA and NS records. To send the apex to a platform or to www you can:

  • Use A and AAAA records to addresses the platform publishes, or to a redirect server that sends the apex to https://www.example.com/.
  • Use your DNS provider's ALIAS, ANAME or CNAME flattening feature. See CNAME at the zone apex.
  • Publish an HTTPS record that points browsers that support it at the platform. See SVCB and HTTPS records.

Whichever you choose, both names need a certificate on the server that answers them, and one of them should redirect to the other so the site has a single address.

HTTPS and redirects

  • The redirect server needs a certificate for the old name. A browser visiting https://old.example.com checks the certificate before it ever sees the redirect. Many free registrar forwarding services only work over plain HTTP, which fails for anyone who types https, follows an https link, or has HSTS for the domain.
  • HSTS makes browsers use https for the name without asking first, so an http-only redirect stops working for returning visitors. See HSTS.
  • Use 301 or 308 for permanent moves and 302 or 307 for temporary ones. 307 and 308 keep the request method, which matters for forms and APIs.
  • Keep the path when moving a whole site, so /pricing on the old domain lands on /pricing on the new one rather than the home page.

Redirect loops

PatternCauseFix
http and https redirect to each otherA CDN talks to the origin over http while the origin redirects everything to https (Cloudflare's Flexible mode is a well-known case)Have the CDN connect to the origin over https, or redirect only at the CDN
apex and www redirect to each otherOne rule at the platform, the opposite rule at the CDN or registrar forwardingPick one canonical name and set the rule in one place
Loop only on some pathsA rewrite rule that matches its own outputTest with curl and fix the rule's condition

Checking what each layer does

CommandWhat it shows
dig +noall +answer www.example.comDNS only: any CNAME chain and the final addresses
curl -sI http://example.com/The first HTTP response: a status such as 301 and the Location it points to
curl -sIL https://example.com/old-pageEvery hop of the redirect chain to the final page. A chain that repeats is a loop.
curl -vI https://old.example.com/Whether the certificate matches the name before any redirect
curl -sI --resolve www.example.com:443:192.0.2.10 https://www.example.com/How one specific server answers for the name, before you change DNS to point at it
curl.exe -sIL https://example.com/ and Resolve-DnsName www.example.comThe same checks from Windows PowerShell

How DNS Panopticon helps

Security Posture checks that a domain's homepage loads over HTTPS and that plain http:// redirects to it, as described in HTTPS and HTTP-to-HTTPS redirects. Website Recon opens the homepage and lists every redirect on the way to where it lands. Domain Visualizer shows the DNS side: the CNAMEs and addresses behind each name. None of them changes your redirects or DNS.

FAQ

Can I redirect a domain using only DNS?

No. DNS can point a name at a server, but only a web server can send the HTTP redirect. Point the name at a server or forwarding service that issues the redirect.

Does a CNAME change the URL in the address bar?

No. The browser keeps the original name and the target server must be set up to answer for it, including a certificate for that name.

Why does my registrar's forwarding fail over HTTPS?

Many forwarding services only listen on plain HTTP or have no certificate for your domain. Browsers check the certificate before they see the redirect, so https visits fail. Use a forwarding service that issues certificates, or redirect from your own web server or CDN.

Should I use 301 or 302?

Use 301 or 308 for a permanent move, so browsers and search engines update. Use 302 or 307 only for temporary moves.

Sources and further reading