I just registered a domain name in Google Domains and when doing initial setup I noticed it had a path forwarding option, with the following explanation:
Path forwarding
For example, if you're forwarding documentationexample.com to example.com, your domain could be forwarded in the following ways:
With path forwarding on: redirects to
With path forwarding off: redirects to example.com.
I wonder how it works in the "path forwarding off" scenario? In my understanding, DNS server can only reply browser's request to translate a domain name to an IP address. The path portion in the URL is not visible to DNS server. How can it tell browser to redirect to example.com?
(I tried to contact Google Domains customer support, but failed to submit the question on their web site).
11 Answer
DNS does not have a concept of forwarding that is similar to HTTP redirects. Of course there’s CNAMEs and stuff, but they just result in aliases.
Both examples (keeping path or dropping it) from the quoted section are not achievable with DNS alone. They involve a web server (operated by Google) sending HTTP redirects.
3