Webmail redirecting to server domain - how to stay on site's domain?

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
I guess I don't understand Tweak Settings > Redirection, because to me, it looks like it should be doing this already :

I want this:
www . domain1.com/webmail to stay on domain1.com
but instead, it's redirecting to www . serverdomain.com:2096

I have purchased SSLs for my domains, but have been using Cpanel certs for email, whm, etc. - I accidentally let the Cpanel cert expire, but when I clicked Reset Certificate, it issued a self-issued certificate instead, which I don't want. So I figure if I can keep the user on my main domains, it will use the purchased ssl certs.

Here's the Tweak Settings > Redirection:
Choose closest matched domain... ON
Non-ssl redirect destination... Origin domain name
SSL redirect destination... SSL certificate name

It wouldn't surprise me if I'm completely misunderstanding something... *sigh*
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Here's what I use for this:

Choose the closest matched domain for which that the system has a valid certificate when redirecting from non-SSL to SSL URLs. Formerly known as “Always redirect to SSL/TLS”
When a user visits /cpanel, /webmail, /whm, or visits other URLs that redirect to a cPanel service, the system will redirect to an SSL URL for the closest matched domain that the system has a valid certificate. If you disable this option, the system will redirect to the equivalent URL that they visited based on the original request made via HTTPS or HTTP. This option also controls how the system will redirect unencrypted cPanel, Webmail, WHM, and DAV requests to the best matched certificate for the domain when “Require SSL” is enabled. When enabled, it will redirect closest matched domain that the system has a valid certificate for. When it is disabled, it will simply redirect equivalent HTTPS URL.
  • Toggled to Off

Non-SSL redirect destination
When visiting /cpanel or /whm or /webmail WITHOUT SSL, you can choose to redirect to:
  • "Origin Domain Name"

SSL redirect destination

When visiting /cpanel or /whm or /webmail with SSL, you can choose to redirect to:

  • SSL Certificate Name default
 

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
Thank you Lauren! I didn't want to just toggle these settings around without advice, and you've been very helpful to me before so I will try this tonight!
 
  • Like
Reactions: cPanelLauren

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
I tried it, but it's still redirecting to the server address instead of the domain.
Did I need to restart something else besides the daemons it automatically restarted when I saved this change?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Hi @ksechrist

Can you tell me what you're doing for the following:

1. What is the URL you're visiting exactly? (replace any actual domain names)​
2. Are you visiting over http or https?​
3. Is there an SSL installed on the domain?​
4. Have you cleared your browser's cache?​

I can confirm that those exact settings work for me when going to webmail/webdisk etc., I do have an SSL on my domain, as well as the hostname. I'm also visiting https://mydomain.tld:2083 or webmail.mydomain.tld
 

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
THANK YOU LAUREN!
I'm not there yet, but clearing cache got me closer.
The problems now:

https://mydomain.tld:2083 takes me to a cpanel login instead of a webmail login

The ONLY subdomain covered by my cheaply purchased SSL is the www.... webmail.mydomain.tld looks like it WILL work now if I pay more to cover the webmail subdomain.

I was really hoping to make this work with www.mydomain.tld/webmail so it would use the existing ssl. Do you think this is possible without a lot of trouble?

Thank you again - I really appreciate your help!
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
https://www.mydomain.tld:2096/ WORKS and is using my purchased ssl cert!!

https://mydomain.tld:2096/ WORKS and is using my purchased ssl cert!! THANK YOU - THAT'S PROGRESS!

https://www.mydomain.tld/webmail redirects to server domain - this is the one I'd really like to use, mostly because this is the link my users have used for many years. Change is hard lol.

I will send my users the https://mydomain.tld:2096/ link for now, but I'm still going to try to get https://www.mydomain.tld/webmail to work - there must be a redirect somewhere that I can undo - any ideas? (I'm still learning Apache root stuff as needed... I'm slowly getting there)

THANK YOU SO MUCH for your help Lauren!
 
Last edited:
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Hello,

I'm glad it's getting there but I am a bit perplexed how you have the same settings but the behavior is different.

With:

SSL redirect destination
When visiting /cpanel or /whm or /webmail with SSL, you can choose to redirect to:
Set to SSL Certificate


and

Choose the closest matched domain for which that the system has a valid certificate when redirecting from non-SSL to SSL URLs. Formerly known as “Always redirect to SSL/TLS”

When a user visits /cpanel, /webmail, /whm, or visits other URLs that redirect to a cPanel service, the system will redirect to an SSL URL for the closest matched domain that the system has a valid certificate. If you disable this option, the system will redirect to the equivalent URL that they visited based on the original request made via HTTPS or HTTP. This option also controls how the system will redirect unencrypted cPanel, Webmail, WHM, and DAV requests to the best matched certificate for the domain when “Require SSL” is enabled. When enabled, it will redirect closest matched domain that the system has a valid certificate for. When it is disabled, it will simply redirect equivalent HTTPS URL.
Set to Off there shouldn't be anything keeping it from performing the proper redirection.

I don't have any relevant redirects added in the .htaccess but you may want to check your own - I do have Forced HTTPS enabled in cPanel>>Domains>>Domains though.
 

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
Those are the settings I have.

The only redirects in my htaccess (other than directing old pages to new pages) is to redirect non-www to www, and http to https. But for some reason, https://mydomain.tld:2096/ does NOT redirect to the www. I don't know why, but I'm not worried about that atm.

I wonder what will happen if I choose "Origin Domain Name" for ssl redirect destination ? I think I will try it tonight after my users are logged out.
Thank you again Lauren!
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Those are the settings I have.

The only redirects in my htaccess (other than directing old pages to new pages) is to redirect non-www to www, and http to https. But for some reason, https://mydomain.tld:2096/ does NOT redirect to the www. I don't know why, but I'm not worried about that atm.

I wonder what will happen if I choose "Origin Domain Name" for ssl redirect destination ? I think I will try it tonight after my users are logged out.
Thank you again Lauren!
You can give it a shot, it should retain the domain exactly how entered.
 

ksechrist

Active Member
Jan 27, 2019
39
8
8
Texas
cPanel Access Level
Root Administrator
Origin Domain Name didn't work for https://www.mydomain.tld/webmail either....
Thank you for trying to help Lauren... at least I do have one link that works now, just not my preferred link.