Change default aliases/redirects

Hi there,
I have a few things that i want to be able to in virtualmin so that when i create a virtual server, it implements these right off the bat.

What i want is the following:
i want the webmail.domain.tld to NOT redirect to https://domain.tld:20000, but the server a global install of my chosen webmail program.

the same goes for mysql.domain.tld. i want this to serve phpmyadmin.

so say i have installed roundcube in /usr/share/roundcubemail and phpmyadmin installed in /usr/share/phpmyadmin, how would i set this up?

i notice that the webmail redirect is present in the directives for the domain.

thanks in advanced for your advice!
Ash

Howdy,

You can tweak the webmail and admin redirects by going into System Settings -> Server Templates -> Default -> Apache Website.

Take a look at the “URL for webmail redirect” and “URL for admin redirect” options – you can tweak those to whatever you want.

What that does, behind the scenes, is add entries like this to the Apache VirtualHost section for that domain:

RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.example.com RewriteRule ^(.*) https://your_domain.com/some_webmail_app/ [R] RewriteCond %{HTTP_HOST} =admin.example.com RewriteRule ^(.*) https://your_domain.com:10000/ [R]

So if you want to setup additional redirects for phpmyadmin and others, what you can do is set them up yourself, much like how Virtualmin sets up “webmail” and “admin”.

You can put something like the above within the “Directives and settings for new websites” textarea in the Apache Website server template – which causes it to be added to each new Virtual Server that’s setup.

-Eric

Hi Eric,
Thanks for your reply.

I think you misunderstand what i am asking or maybe i didn’t explain myself well enough
I do not want the browser to be redirected, i want it to serve “webmail.domain.tld” but that domain would be mapped to “/usr/share/mywebmailapp”,

so instead of going to webmail.domain.tld and being redirected to https://domain.tld:20000 the browser would stay at webmail.domain.tld and the user would be presented with the webmail app i have installed.

i hope that explains my requirements a little more.

if you have told me the right way to configure it, then i’m sorry and could use a bit more help on the subject. your help is much appreciated and i know you try hard to help!

Thanks again
Ash

Okay, I think I understand what you’re after.

Just to make sure what I offered can’t be of use –

What I did on my own server, was setup a webmail app here:

https://secure.my_domain.com/webmail_app/

So any user going there gets the benefits of my commercial SSL certificate.

However, I don’t expect them to type in that URL, so I still configured webmail.their_domain.com to redirect to my system-wide webmail setup at https://secure.my_domain.com/webmail_app/ .

Would that by chance accomplish what you’re after?

It does still redirect, but it redirects to a “friendly” place :slight_smile:

If that’s not what you’re after – what you’d need to do is setup an Apache alias – using something like:

Alias /webmail/ “/usr/share/your_webmail_app”

I recommend the first suggestion above… but you can do it with this Apache alias :slight_smile:

-Eric

I think theashman wants a frameforward, but it is highly not recommended. An Apache redirect is way faster plus you have the benefit of a ssl certificate doing it like Eric described

Another way: http://www.virtualmin.com/node/14420#comment-63125