> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.serverfreak.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to Block phpinfo Page in cPanel Using .htaccess

In order to avoid potential hacker from accessing your phpinfo page, it's wise to protect or remove any phpinfo.php or other sensitive files that you may have sitting around on your server. 

Here's how you can protect your phpinfo page by using .htaccess by inserting the following code:


**# protect phpinfo**
**<Files phpinfo.php>**
**	Order Deny,Allow**
**	Deny from all**
**</Files>**

Once you have saved the .htaccess file above, please follow the following steps to upload into your public_html directory.


1.  Login to **cPanel** and click on **File Manager**

![](https://storage.crisp.chat/users/helpdesk/website/0e35a1b5-ce97-4d12-a27e-1bbafd0ae641/6b19f9ce-3b89-4b79-83a6-cd60fd011189.png)


2. Double click on the path you wish to place the .htaccess file. For example, the public_html directory

![](https://storage.crisp.chat/users/helpdesk/website/0e35a1b5-ce97-4d12-a27e-1bbafd0ae641/3871a629-18cc-45a9-b79e-a1dfd6058498.png)

3. Click **Upload** from the top menu and click on **Select File**

![](https://storage.crisp.chat/users/helpdesk/website/0e35a1b5-ce97-4d12-a27e-1bbafd0ae641/6e8f5a12-d17a-4701-873e-c583bde931b1.png)

![](https://storage.crisp.chat/users/helpdesk/website/0e35a1b5-ce97-4d12-a27e-1bbafd0ae641/5607e656-25b0-489b-9c87-e3a318ac8d6c.png)


4. Your .htaccess file has been uploaded into public_html directory successfully.

If you try to visit the phpinfo page e.g. http://yourdomain.com/phpinfo.php , you shall see **Error 403 Forbidden** as seen below.

![](https://storage.crisp.chat/users/helpdesk/website/0e35a1b5-ce97-4d12-a27e-1bbafd0ae641/1d463d70-9c19-46c4-84dc-082a75b27cef.png)