Admin and Webmail Redirect Configuration

I changed the Webmin and Virtualmin ports a while ago, and my virtual domains are still redirecting to the old port. I searched in the DNS settings and Server templates as advised by forum posts, but were not able to find the place, where I could specify the redirect. If this should not be realizable via the user interface: which files in the system should I change?



Howdy -- you may want to verify that in System Settings -> Server Templates -> Default -> Apache Website, that the redirects listed in there are set properly for your setup.

Also, after making that change, it will only affect new domains. You would need to disable, and then-enable, the Apache website feature for your domains in order to re-create that redirect.

In the sections "URL for webmail redirect" and "URL for admin redirect" I have the option "Use domain name" set and thus no ports specified. This led me originally to the conclusion that the actual redirect setting must reside in some configuration file elsewhere. In all the sites-available / sites-enabled files I do find the wrong settings

RewriteCond %{HTTP_HOST}
RewriteRule ^(.*) https://domain.tld:20000/ [R]
RewriteCond %{HTTP_HOST}
RewriteRule ^(.*) https://domain.tld:10000/ [R]

But I wish to figure out how these directives made it into the apache site configuration files as the server template just says

ServerName ${DOM}
ServerAlias www.${DOM}
DocumentRoot ${HOME}/public_html
ErrorLog /var/log/virtualmin/${DOM}_error_log
CustomLog /var/log/virtualmin/${DOM}_access_log combined
ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory ${HOME}/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
<Directory ${HOME}/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

which prooves that there are no redirect settings explicitly given in the server template.

Have you found a solution to this issue? I'm facing the same problem...

Steffan's picture
Submitted by Steffan on Tue, 10/11/2016 - 15:18 Pro Licensee

It seems at a quick glance you can override where and if the admin and webmail URLs go to in the section of the template where it says

Redirect webmail.domain to Usermin?   Yes   No
URL for webmail redirect     Use domain name       
Redirect admin.domain to Virtualmin?     Yes   No
URL for admin redirect Use domain name

The port is configured in the Webmin configuration "Webmin > Webmin Configuration > Ports and Addresses" and is embedded in the config as the site is created. I don't see a way to automatically change it after the domains are created, only going forward. It seems you'll have to manually update the apache config with a find and replace on the global config or some kind of sed from the command line to change all 10000 to the new port. I do think it would be nice for those directives to be put in the template text area rather than the radio dials but that's a feature request as well as changing it on all sites after creation. I'd suggest reposting this as a feature request but for now you have an understanding of where it's configured.

Yeah, it's a missing feature that the port doesn't get updated in the redirect if you change Webmin or Usermin from 10000 or 20000 after creating some domains.

Hi there

I see this topic is now a year old,

Can anyone tell me if there is now an easy way to set the port used in the webmail redirect? I have, as others have previously mentioned, set the new port in the Usermin port setting but the webmail redirect still takes you to port 20000 and now of course shows page not found .

Any advice would be appreciated

Kind Regards Brad

@brad100 - are you seeing this even for domains created after you changed the port?

For those, you will have to edit it in your Apache config file (/etc/init.d/httpd/httpd.conf)

Hi @JamieCameron Thank you very much this is just what I want to know. Yes the server being used for the hostname was created before I updated the port. All the best Brad