How to redirect/link subdomain to folder

Hi,

I have a webmail installation here: domain.com/email

I want to enable users to enter: email.domain.com and be redirected to the folder.

I don’t care if they don’t see the subdomain anymore once they are redirected.

Both the main website and webmail will work with SSL (positive), what I don’t want is to have tu buy a wildcard cert, just to cover for a redirect.

I have seen several threads:

http://www.virtualmin.com/node/20943
https://www.virtualmin.com/node/14782

Tried those options but I ultimately get an error at some point.

I would certainly appreciate your help.

Howdy,

Hmm, how would you feel about using “webmail.domain.com” redirecting to your central webmail installation?

Virtualmin already provides a simple way for that to work.

You can configure that redirect in System Settings -> Server Templates -> Default -> Apache Website, and there you can configure “URL for webmail redirect”.

-Eric

Hi Eric,

Thank you for your suggestion. Will this affect the existing installation, or do I need to setup a new virtual server using this edited template?

Can this not be configured through .htaccess more easily?

Many thanks!

Templates generally only affect newly created virtual servers (or features being turned on). To modify an existing one, after changing the template, you either need to turn the Apache feature off and on, or edit its virtual host file manually.

The webmail redirect is achieved through mod_rewrite rules by Virtualmin, it might be possible to put those directives in an .htaccess too. But the “cleaner” way is to do it the Virtualmin way, as outlined above. Otherwise you’ll probably run into issues if you make other changes to the virtual server, since Virtualmin doesn’t know about your manual thing in .htaccess.