subdomain alias

I know the word “subdomain” tends to ruffle a few feathers around here, so I start by begging your patience. This concept remains cloudy to me, in the Virtualmin context, and I wish to clarify things before I do something that breaks the entire Internet. :smiley:

What I want to do is take the “subdomain” (please consider this only as a URL pointer, and not a directory structure) and use that merely as an alias of a directory on my site. Like this:

webmail.myVirtualServer.com = myVirtualServer.com/libs/webmail

Which is the best method to obtain my ends?

  1. create a Virtualmin sub-server (which I would rather avoid doing), or

  2. merely add a rewrite rule to my httpd.conf?

Note that “webmail.myVirtualServer.com” currently redirects to “myVirtualServer.com:20000”.

Right. So I read more on the docs, specifically: Webmail and Virtualmin: Webmail Redirects,

PLUS had a closer look at my httpd configuration file, specifically the lines:

RewriteCond %{HTTP_HOST} =webmail.myVirtualServer.com
RewriteRule ^(.*) https://myVirtualServer.com:20000/ [R]


and it is apparent to me now that Virtualmin has already set this up.

I’m correct right?

I have installed Roundcube using the Virtualmin install script, and it works beautifully, when accessed at myVirtualServer.com/libs/webmail

The problem is that the browser hangs upon opening the 20000 port via the url (myVirtualServer.com:20000). I still want my users to be able to access their webmail by entering “webmail.myVirtualServer.com” into their browser address field.

Safari: Safari can’t open the page “https://myVirtualServer.com:20000” because the server where this page is located isn’t responding.

Chrome: This site can’t be reached myVirtualServer.com took too long to respond. ERR_CONNECTION_TIMED_OUT

How can I fix this and make logging into webmail (roundcube) a seamless process for my clients?

You are using the term “subdomain” exactly correctly, so nobody is going to get grumpy with you. It’s a name, and that’s what you’re talking about. So, cool.

The redirect you see is for Usermin, which is the default webmail client in a Virtualmin system (it is a version of Webmin that runs as the logged in user and provides webmail, password changes, auto-responders and forwarders, and a few other features).

If you want to point to RoundCube instead of Usermin, you’ll need to change the URL to point to your RoundCube installation (myVirtualServer.com/libs/webmail).

If you wanted to use Usermin, we’d need to sort out why it isn’t loading.

Joe,

I may have a look into why Usermin is not loading, but it’s a lower concern for me right now. I don’t want my users to have any kind of access to passwords, forwarders, etc. save for what I built for them. If you knew the users, you would understand. :slight_smile:

In the meantime, I’ll report that your recommendations worked. I switched the rewrite above to:

RewriteCond %{HTTP_HOST} =webmail. myVirtualServer.com
RewriteRule ^(.*) https://myVirtualServer.com/libs/webmail/ [R]



And it redirects like a charm.

However, I wanted the user to see no change from the “subdomain” type of webmail access that they are used to and comfortable with. So I further changed the rewrite to:

RewriteCond %{HTTP_HOST} ^webmail.myVirtualServer.com$ [NC]
RewriteRule ^((?!webmail/).*)$ /libs/webmail/$1 [L,NC]



Now the browser’s address bar displays “webmail.myVirtualServer.com” even though the files are being served from /libs/webmail/

And everyone is happy.

Thank you again for your help.