@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.
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.
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?
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
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 websitehttps://www.example.com/
HTTP redirect type: Default
Redirect sub-directories to: Same sub-directory under destination URL
Enable redirect for: HTTPHTTPS
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.
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.