Redirect whm/cpanel users to hostname

rappie

Active Member
Oct 4, 2008
29
4
53
Amsterdam
Hi,

How can I configure that users who try to access WHM or cPanel trough the server IP (on either http or https) will be redirected to the hostname of the server?

So if users tries to logon to WHM on 199.xx.xx.200:2087 I'd like them to be forwarded to server010.example.com. Same for cPanel.
 
Last edited by a moderator:

SysSachin

Well-Known Member
Aug 23, 2015
604
48
28
India
cPanel Access Level
Root Administrator
Twitter

danielpmc

Well-Known Member
Nov 3, 2016
78
33
18
usa
cPanel Access Level
Reseller Owner
Hello rappie,

You said:
So if users tries to logon to WHM on 199.xx.xx.200:2087 I'd like them to be forwarded to server010.example.com. Same for cPanel.

Most individuals that allow others to access their server either as an admin, reseller or client will one day face your issue. But it is not an easy fix, unfortunately. Reason being, many internal and external system services are assigned to the IP address only. Some will not send/receive if they are redirected in any way for security reasons. Another reason is that you could potentially create a loop in your server by system services entering/exiting your server since they use fixed pre-assigned urls with the servers IP.

I suggest researching online and see if it is poosible to create a redirect in your Apache httpd file. Make sure to create a backup of the entire httpd file BEFORE editing.
 
  • Like
Reactions: rappie

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
So if users tries to logon to WHM on 199.xx.xx.200:2087 I'd like them to be forwarded to server010.example.com. Same for cPanel.
Hello,

There are no options available to automatically redirect users who utilize the specific port numbers in the URL. The options under the "Redirection" tab in "WHM >> Tweak Settings" are available to redirect users to the SSL/TLS ports when visiting /cpanel, /webmail, /whm, etc.

Thank you.