Disable mysite.tld/whm And mysite.tld/cpanel Shortcuts?

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello :)

Could you elaborate on how you would prefer they are disabled? Is it just the redirects you want to disable, and not the ports? Or, are you attempting to limit access based on IP address?

Thank you.
 

Jim_WHM

Member
Jun 12, 2014
16
0
1
cPanel Access Level
Root Administrator
It's the redirects I want disabled. I want a 404 Not found error when someone does mysite.tld/whm, mysite.tld/cpanel, or mysite.tld/webmail.

I'd like to use different ports for WHM and cpanel but after googling I don't think that's going to be possible in an easy way - so nm that.

The reason I'd like the redirects disabled is I'm putting the site under Cloudflare, and disabling all non-html ports through it. But if those redirects are there I think it might things up. I plan to just access WHM/CPanel via IP address.
 

Jim_WHM

Member
Jun 12, 2014
16
0
1
cPanel Access Level
Root Administrator
The solution in that thread didn't work for me unfortunately because for some reason the distiller does not work for me.

Any idea why the distiller wouldn't work for me?

Is there some way to remove these lines using templates?

ScriptAliasMatch ^/?controlpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?kpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?securecontrolpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi
ScriptAliasMatch ^/?securecpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi
ScriptAliasMatch ^/?securewhm/?$ /usr/local/cpanel/cgi-sys/swhmredirect.cgi
ScriptAliasMatch ^/?webmail/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi
ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi
 

Jim_WHM

Member
Jun 12, 2014
16
0
1
cPanel Access Level
Root Administrator
Thanks removing these lines from main.local worked.

PHP:
[% FOREACH dir IN main.scriptaliasmatch.items -%]
ScriptAliasMatch [% dir.regex %] [% dir.path %]
[% END -%]
I rebuilt apache and everything survived. It took me a while to realize I had to clear all browser history and data though to make it work. I guess the redirects were saved in the browser.
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
I am happy to see that solution was helpful. Thank you for updating us with the outcome.

Thank you.