I had created an ecommerce website named http://example.com. I want to block my cpanel link for users who are accessing my website. Link is example.com/cpanel. If any I.T. specialist user or general user go to my http://example.com/cpanel link then he should go on my homepage link.
First thing you need to understand is that: for a webserver, both the owner and normal site visitors are the same. There is no default mechanism to identify a "Site owner".
To achieve your goals, you can do below:
- Cpanel: Restrict the cpanel access from one or more IPs only. Or run cpanel on a different port which the normal users can't guess. Hope this url helps: https://forums.cpanel.net/threads/why-cpanel-dont-have-allow-only-my-ip-for-login.246512/
There is an option for your hosting provider to enable WHM > Security Center > Configure Security Policies area that is called "Limit logins to verified IP Addresses"
If your provider has not enabled this, I would suggest contacting that provider to request they consider doing so. We have had this option available for at least 9 months in WHM.
I think you can use 301 url redirect for this issue you can send them 404 page of your magento or send them home page when they access your cpanel.
Add below code in your .htaccess file
<IfModule mod_rewrite.c> #301 redirect #first option throw them on home page redirect 301 /cpanel/ / redirect 301 /cpanel/ /your404urlpage </IfModule>