redirect a specific subdomain to domain.com:port
Hello
I was using CWP before moving to cPanel
and in CWP we used mail.domain.com URL doesn't access webmail(Roundcube), it opens the same page of mail.domain.com to opens webmail.domain.com
and we don't need that, because all employees are saved mail.domain.com, and made a redirect to
-
Hey there! By default, cPanel creates the following two records in the DNS for the domain: mail IN CNAME domain.com. webmail IN A x.x.x.x where "x.x.x.x" is the IP address of your server. In addition to that work, we included "mail.domain.com" as a ServerAlias entry in Apache. This does two things: -allows the SSL certificate for the domain to include the mail subdomain, allowing mail clients to connect securely -does cause someone browsing to mail.domain.com to reach the main domain, although that usually doesn't happen as most users wouldn't manually type that in. With the way this is configured in cPanel, there isn't a way to make those changes. It is part of both the cPanel software templates and the Apache templates. The best thing to do would be to explain to your users that you've changed systems and that they should now use the "webmail" subdomain to access email. 0 -
Hey there! By default, cPanel creates the following two records in the DNS for the domain: mail IN CNAME domain.com. webmail IN A x.x.x.x where "x.x.x.x" is the IP address of your server. In addition to that work, we included "mail.domain.com" as a ServerAlias entry in Apache. This does two things: -allows the SSL certificate for the domain to include the mail subdomain, allowing mail clients to connect securely -does cause someone browsing to mail.domain.com to reach the main domain, although that usually doesn't happen as most users wouldn't manually type that in. With the way this is configured in cPanel, there isn't a way to make those changes. It is part of both the cPanel software templates and the Apache templates. The best thing to do would be to explain to your users that you've changed systems and that they should now use the "webmail" subdomain to access email.
Hello cPRex, Thanks for your reply I have the DNS records sets correctly as you mentioned and regarding: [QUOTE]In addition to that work, we included "mail.domain.com" as a ServerAlias entry in Apache. This does two things:
I don't know how to do that exactly and yeah we do want anyone to access the URL: mail.domain.com to open the webmail.domain.com or domain.com:2096 maybe [COLOR=rgb(226, 80, 65)]change default webmail.domain.com to be mail.domain.com as a main webmail login URL or [COLOR=rgb(226, 80, 65)]adding mail.domain.com to be an [COLOR=rgb(226, 80, 65)]alias of webmail.domain.com or [COLOR=rgb(226, 80, 65)]make mail.domain.com [COLOR=rgb(226, 80, 65)]redirect to webmail.domain.com somehow, without creating mail subdomain So how to make it happen using any of these suggestions without causing any issues? Thanks and waiting for your reply0 -
While I'm a firm believer of "anything is possible" there isn't a supported way to make these types of configuration changes to the system. 0 -
So, there's no way to even change the main webmail URL from the cPanel Configs? for sure this link isn't hardcoded !! and i'm only talking about 1 account, we do have license for only 1 account. 0 -
It's hardcoded both in cPanel and in the Apache templates that create the service subdomains. 0 -
so there's no way to add a new service subdomain that acts like webmail ? or maybe creating a subdomain named mail and redirect it to webmail.domain.com ---< using this idea changes incoming / outgoing server from mail.domain.com to domain.com so is there a way to create that subdomain named: mail and use it to redirect to webmail.domain.com without changing incoming / outgoing server? and keeping them as mail.domain.com because if incoming / outgoing server changed to domain.com the emails in mail clients won't work --- Another idea can we use .htaccess in virtual sub-domain or anywhere and do the redirect from webmail.domain.com to mail.domain.com on it? 0 -
There isn't a way to change the service subdomain behavior at this time. If you wanted to see options to create custom service subdomains, that would make an excellent feature request. You can open a feature request using the link in my signature. For the .htaccess option, it wouldn't hurt to try it out, but this isn't something we test on our end. 0 -
There isn't a way to change the service subdomain behavior at this time. If you wanted to see options to create custom service subdomains, that would make an excellent feature request. You can open a feature request using the link in my signature. For the .htaccess option, it wouldn't hurt to try it out, but this isn't something we test on our end.
That's a good idea to submit a feature request for that since there's a lot of posts requesting the same feature regarding .htaccess option, i don't know how to do it exactly, so if you can help me to test it at my end ?0 -
I did see the feature request come in and got that approved. Using the following code worked well for me on a test domain when placed at the top of the .htaccess file. You want to make sure it is above the cPanel PHP block or else it may not be read properly: RewriteCond %{HTTP_HOST} ^mail.domain.com [NC,OR] RewriteRule ^(.*)$ https://webmail.domain.com/$1 [L,R=301,NC]0 -
I did see the feature request come in and got that approved. Using the following code worked well for me on a test domain when placed at the top of the .htaccess file. You want to make sure it is above the cPanel PHP block or else it may not be read properly:
RewriteCond %{HTTP_HOST} ^mail.domain.com [NC,OR] RewriteRule ^(.*)$ https://webmail.domain.com/$1 [L,R=301,NC]
Thanks cPRex i'm sorry to ask you again, where exactly to put this .htaccess file with the mentioned code you sent. Like i said i'm new to this stuff.0 -
The .htaccess would be located in the document root for the site, which is /home/username/public_html/.htacces. Just place that code in there, edited to be your actual domain name, and it will likely just work without any other adjustments needed. 0 -
The .htaccess would be located in the document root for the site, which is /home/username/public_html/.htacces. Just place that code in there, edited to be your actual domain name, and it will likely just work without any other adjustments needed.
if i put it into /home/username/public_html/.htacces, then when access mail.domain.com it will redirect it to domain.com, then domain.com will redirect it to webmail.domain.com I'm i right?0 -
Great - I'm glad that's working well for you now! 0
Please sign in to leave a comment.
Comments
15 comments