No, it's not possible to achieve this using DNS only. DNS have no notion of redirect and there are a variety of reasons. Probably the most important, the redirect is essentially a part of the HTTP protocol and it's not necessarily related to DNS records.
You could potentially issue a redirect connecting directly to an IP or, vice-versa, a redirect concept would not make sense at all for a TXT record or even for a A record where the target server accepts only ssh connections (or any other protocol rather than HTTP(s)).
In order to achieve a redirect you need to
- Point the hostname to a server
- The server should be configured to accept HTTP connections
- The server should also be configured to understand HTTP connections for the source hostname
- and redirect the client via HTTP to the target hostname
The CNAME or A record would only cover the step 1, but in order to cover the others you also need a server that handles the HTTP redirect (because as explained this is part of the HTTP protocol and not currently covered in the DNS protocol)
There are a few possible solutions:
- Point the old domain to a custom server/site where you handle the redirection. You can easily accomplish it for free, for example with a simple app on Heroku.
- Use a DNS provider that offers you some kind of redirection service.