Sub domain pointing to specific server:port

I know I’m new at this, you don’t have to remind me, but I think the software has the capability of this and I’m not finding the documentation to do it.

We have a domain name ( and I want to add a sub-domain of ( but I don’t want it going to the same /public_html directory that our original domain it pointing to. In fact, I want to point it to another server and port in our system (adminsrv06:9675/portal) which is the helpdesk portion of Spiceworks which I have installed.

I started to configure the subdomain, but after that, I’m lost. Can someone point me in the right direction?


Well, adding a Sub-Server (in Create Virtual Server -> Sub-Server) will indeed put it in a different directory tree. Whether the Sub-Server you’re adding is a domain or a sub-domain – Virtualmin treats those all the same. They’re just new domains :slight_smile:

As far as getting it to point to the additional port and path – there’s a few ways to accomplish that, but one way would be to go into Server Configuration -> Website Redirects, and have anyone browsing to that domain “” redirect to your desired port and path.


I may be mistaken, but If I recall correctly, the things in Vmin’s “Website redirects” use the “Alias” and “Redirect” Apache directives, both of which only operate on URL paths within the virtual server’s domain, and cannot extend the domain name.

To redirect a different domain name, you need to use some mod_rewrite magic, as in edit the server’s Apache config file directly. Example:

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

(When using those lines, replace “-http-” with “http”. I need to write it so strangely to prevent the forum software here from trying to auto-create some broken A HREF link.)

At least this is the method Vmin itself uses to redirect e.g. “” to “”. There’s surely a reason why Vmin uses the complicated mod_rewrite syntax there and not Alias or Redirect. :slight_smile:

you can try this.
RewriteCond %{HTTP_HOST} =subdomain.domain.tld
RewriteRule ^(.*) https://yourip:port/ [R]

it’s quite simple to add to the /etc/httpd/conf/httpd.conf ,

ServerAlias =

RewriteCond %{HTTP_HOST}

RewriteRule ^(.*) http://ipaddress:port/folder [R]

it’s pretty much a crude way but still works.