For some reason, Google Domains does not have a mask feature. Is it possible to do this using custom resource records or synthetic records?
Masking is horrible and nobody should ever use it.
- It doesn't work for SEO. Search engines see right through it and index the hidden URL rather than the domain with masking.
- Users can choose to use either the masked URL, or the real URL. There is nothing that forces users to use the masked URL.
- It isn't good user experience if users try to use the masked URL. As they click around your site, the URL never changes so they can't bookmark deep pages.
This is because URL masking is implemented as an HTML frameset. The mask is a simple HTML page that uses frames to contain another website as 100% of its content. If you want to implement masking yourself, simply point the domain at a server and serve up a single HTML page with the contents like the following, substituting in something other than
<html><head> <title>example.com </title> </head><frameset><frameset rows> <frame src="https://example.com/"> </frameset></html>
You also seem to have another misconception about redirects and masking. You talk about implementing them with "records", by which I assume you mean "DNS records". DNS is not capable of implementing any HTTP redirects or framing. All DNS can do is point the domain at an IP address. That IP address must have a running HTTP server that issues the redirect requests.
I find that most of the time when somebody says they want a "masked redirect", what they actually want is their content hosted at that domain name. To do so, you don't redirect to the domain name at all. The steps are usually:
- Add the domain to your web hosting account. This will configure the server with virtual hosts so that requests for that domain name are mapped to a directory under your control.
- Use DNS
Arecords to point your domain and the
wwwsubdomain to the IP address of your web host's server.
So the only time that you should consider using masking is when your web host doesn't allow you to add domains to your web hosting account. In that case though, I would recommend getting a better web host rather than try to use masking.