If your system is PHP or something technologie in which you work only by the filesystem - (that is: your only access to the server is by FTP, or other technology to put files there) - the redirect using a response HTTP - 301 is the only way to do this. (But in that case it's still better to use a 301 real answer than a static HTML file with a meta tag for it - on limited access servers this is possible with PHP or a CGI script)
DNS will always point to an IP - (I currently believe most records can point to both IPv4 and IPv6) - and what will be the root of a given domain is your web server that listening on ports 80 and 443 (usually Apache or Nginx). So if you have access to the Web server configuration, you can perform the configuration you want.
The HTTP request arrives at the server with the information of the desired domain - and from there the configuration of the request can modify the request so that it internally uses another URL (and modify the output data to restore the original domain).
Since it is a complex URL on another system and not just a specific point with static files in the filesystem, with Apache you should use mod_rewrite .
With Apache, you can specify modrewrite redirect rules in .htaccess
files that you have control of even on a server that has access only to the filesystem. However, the redirect rule must be in a .htaccess
file located in the root of the domain you want to redirect to the internal URL: without access to the same server configuration, the only way to do this is by hiring a separate account for the another domain - and hence it is better to give an HTTP response 301 anyway. (since nothing guarantees that the second account will be on the same IP and being serviced by the same server as the first one)
In Nginx, the functionality of Mod_rewrite is part of the core of the rules specification, and you can get an idea of where to start with the official rules documentation - but here are some examples of how to do a simple rewrite.
Remember that even if you only have access to the filesystem, if you fully understand what the required rewrite rule in Apache / Nginx would be, you should ask your ISP to put the rule for you. It may have an extra cost - but it will certainly be less than hiring another account.
(Nowadays most people and-and the best Web technologies require-a system where you have control at least at the shell level in this case it would be possible to create a separate root for the other domain and write one .htaccess
- but better still is access to a VPS - in which you have total control including the webserver)