Where are the mail subdomain redirects added

@Jamie A long time you implemented this. Can you tell me the following.

  • Where did you actually make the change for new websites. I want to see the code so I can tell what was altered. I am assuming that the mail. sub-domain will have a redirect rule that is added on setup rather than manually adding a redirect rule for old websites.
  • I know I can use redirects, but I want to keep things neat.

Thanks

If you want to configure redirects for new websites, this can be setup at System Settings → Server Templates → Default settings → Website for domain → Redirects for new websites.

I thought you were adding some code to automatically redirect the mail domain.

No, you’d need to configure it like so :

I think this should be added into the default template for new installs.

1 Like

From what I remember, the redirect rules for mail.domain get applied during the initial virtual server setup through the Server Templates config, not as a separate manual rule. For older sites you’d still have to add the redirect yourself unless you edit the template and re-apply.

Dows anyone have any new domains that you have setup on Virtuamin v7.40.1 or later to see if the mail. subdomain redirects to the main domain without any manual redirects being setup?

thanks

use the knowledge above, what iexactly do i put in the redirect field so i can redirect all of the trafic from my mail subdomain to my main domain keeping the SLUG

https://mail.quantumwarp.com/kb/articles/61-php/896-getting-poedit-to-work-with-smarty-tsmarty2c-php-extractor
-->
https://quantumwarp.com/kb/articles/61-php/896-getting-poedit-to-work-with-smarty-tsmarty2c-php-extractor

thanks

my ref: How to configure my redirect

For new domains, it’s like what Jamie says above. For existing domains under Domain > Web Configuration > Website Redirects, add this:

Source URL path: /
Destination: URL at other website https://www.example.com/
HTTP redirect type: Default
Redirect sub-directories to: Same sub-directory under destination URL
Enable redirect for: HTTP HTTPS
Limit redirect to hostname: mail.example.com

This adds the following to, for Debian, /etc/apache2/sites-available/example.com.conf within both the <VirtualHost *:80> and <VirtualHost *:443> sections.

RewriteCond %{HTTP_HOST} =mail.example.com
RewriteRule ^/(?!.well-known)(.*)$ https://www.example.com/ [R]

Note that this redirect interacts with the following, which exists in both sections too.

ServerAlias mail.example.com

If you don’t need that alias, you can remove it. For new domains, you can edit the content of Virtualmin > System Settings > Server Templates > e.g. Default Settings > Website for domain > Directives and settings for new websites and remove ServerAlias mail.${DOM}.

If you remove it, apache will redirect to the Default website for IP address, which is set under one of your domains’ Web Configuration > Website Options pages.

There might be other configuration items for Virtualmin, for the domain, or for the OS that interact and influence the outcome of changes you make.

This rule would be a problem as it rewrites all URLS on the mail.quantumwarp.com domain to the root on the quantumwarp.com and I want to preserve the slug.

rewrite rule switch domain retain slug

  • so the following adds the redirects into the Apache Directives?
  • Is it possible to use this to pass the slug

I can write htacccess rewrite rules. i am trying to work out if this page will do it or if it is of no use to me.

Thanks