
DNS records and website redirects are often confused because both can affect where a visitor ends up. They operate at different layers. DNS helps a client find the network endpoint for a hostname. An HTTP redirect is a response from a web server or application telling the client to request another URL.
When a browser needs to connect to www.example.com, it uses DNS to find information such as an IPv4 or IPv6 address, or an alias that eventually resolves to an address. DNS does not normally know the path portion of a URL, such as /products/item, or the query string after a question mark.
| Mechanism | Layer | What it does |
|---|---|---|
| A / AAAA | DNS | Maps a hostname to an IP address |
| CNAME | DNS | Aliases one hostname to another |
| 301 | HTTP | Signals a permanent URL redirect |
| 302 | HTTP | Signals a temporary redirect |
An HTTP redirect is a response containing a redirect status code and a Location header. The browser then requests the destination URL. A redirect can change the hostname, path, or query string, which is why it is the appropriate tool for moving visitors from one URL to another.
HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/new-page
A redirect requires a server or service to receive the original request and return the response. Merely changing a DNS record does not create that behavior.
Use DNS when you need a hostname to resolve to the correct service. For example, an A record may point a domain to a web server’s IPv4 address, while a CNAME may make www an alias of the root domain where the DNS provider supports that arrangement.
DNS is also used for mail routing and service verification. Changing web records without reviewing MX and authentication records can disrupt email even if the website continues to work.
Use an HTTP redirect when the requested URL should lead to a different URL. Common examples include redirecting HTTP to HTTPS, consolidating www and non-www versions, moving an old page to a replacement, or redirecting a retired domain to a new site.
Choose the status code based on intent. A 301 indicates a permanent move; a 302 indicates a temporary move. Other redirect codes exist for specific method-preservation behavior. Avoid redirect chains when possible because each hop adds latency and another possible failure point.
DNS answers can be cached according to their TTL, so a record change may not be visible everywhere immediately. Browsers and intermediaries may also remember permanent redirects. When testing a migration, use a clean browser profile or command-line tools and be aware that cached behavior can make a fixed configuration appear broken.
An HTTP redirect is a response from a web server or application telling a client to request another URL. The response includes a status code, such as 301 or 302, and a Location header. Because the browser must first reach a server, a redirect depends on the hostname resolving and the connection reaching a service that can issue the response.
Use a permanent redirect when a URL has moved permanently and a temporary redirect when the move is temporary. The choice affects caching and how search engines interpret the change, so avoid using a permanent redirect for a short-lived test unless that is intentional.
DNS maps names to records. It does not process URL paths such as /old-page or /products/item-1, and it does not return HTTP status codes. A DNS record can direct a hostname to a server, but the web server or application decides what content or redirect to return after the request arrives.
Use a command-line client to inspect the response and follow the redirect chain. Confirm the status code, Location header, number of hops, and final destination. Test both HTTP and HTTPS if both are supported, and check whether query strings should be preserved. DNS tools can verify name resolution, but they cannot confirm that an HTTP redirect is configured correctly.
DNS gets the visitor to the service; an HTTP redirect tells the visitor to request another URL. Use each for the job it is designed to do, and test the complete path from name resolution through the final response.