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:

  1.  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
  2. Edit the copied file using your preferred text editor.
    vi /var/cpanel/templates/apache2_4/ea4_main.local
  3. Here we are going to remove the /cpanel from the access URL.
    Remove the following line from the file ea4_main.localScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi

  1. Save the file.
  2. 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.

Leave a Reply