The options you give are correct:
apache virtualhost
You can create a redirect here, when you do that you have to point the DNS records to the server where apache is running:
an example can be found here:
https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx
htaccess
Similar to the virtualhost solution except that he redirect is made in another file example: Redirect all request from old domain to new domain
dns records/domain forwarding from registrar
With a DNS record only you can't do a redirect it should always be used with a forwarding service or one of the other options given
programmatically
You can create a redirect in the code, you should point the DNS records to the server running the application and make your webserver listen to the domainnames.
example in PHP: How to redirect to another page using PHP
Cheers!