Remove redirection to cPanel Access URL from domain
There are various methods to reach your cPanel login page such as yourdomain.com/cpanel, yourdomain.com:2083, etc. Anyone can always reach your cPanel Login page via these methods. In the following guide, we are going to remove the redirection to the cPanel access URL – yourdomain.com/cpanel
in order to stop others to visit your cPanel login page.
Requirements :
- cPanel based server
- SSH access
Steps to remove the redirection to cPanel Access URL:
- Copy the Apache 2.4 template for EasyApache 4 to allow customization. By using the following command.
cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
- Edit the copied file using your preferred text editor.
vi /var/cpanel/templates/apache2_4/ea4_main.local
- Here we are going to remove the /cpanel from the access URL.
Remove the following line from the fileea4_main.local
ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
- Save the file.
- Rebuild the Apache Configuration file. Using the following command.
/scripts/rebuildhttpdconf
You have successfully removed redirection to the cPanel access URL. Now the yourdomain.com/cpanel will not take users to the cPanel login page.
Need to set up redirects for domain? You can follow the guide here.