Forward subdomain to a port number

I am trying to forward a subdomain to a specific port #.

Example: I have installed a jukebox server and it is using domain:port. Instead of using my domain:port I would like to use and forward it to domain:port so I do not have to enter the port # to access the site. Is this even possible?

Sure this is possible, using the magic of mod_rewrite. I suppose there’s nearly nothing that you can’t do with mod_rewrite. :wink: It is also what Virtualmin itself uses to realize the forward of “webmail.mydomain.tld” to “https://mydomain.tld:20000”.

Here’s the syntax for the Apache config:

ServerAlias RewriteEngine on RewriteCond %{HTTP_HOST} RewriteRule ^(.*) h-t-t-p:// [R]

Replace “h-t-t-p” with “http” of course when you enter it. Need to write it this way because otherwise this “suboptimal” forum software will auto-convert it to some nasty attempt to produce an a href link. :slight_smile:

In addition, you need to configure your BIND DOMAIN to have “” resolve to the appropriate IP address.