1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Redirect an external subdomain to an external IP address stating port number
On the other hand, it is possible to do so by creating an internal sub-domain abc.yoursite.xyz redirecting automatically to the sub-directory http://www.yoursite.xyz/abc/ , which will then be able to perform a redirection by adding a rewrite rule.
To do so, create a web/abc/.htaccess file and enter the following there:
— or —
RewriteRule ^(.+)$ http://external_server:8123/subfolder/
8123 is of course to be replaced by the port number that you wish to reach.
RewriteRule ^xyz[/]* http://external_server:8123/subfolder/
Link to this FAQ: