How to hide the files located under the public_html like php.ini showing configuration contents if visited with URL's.

If you want the hide any existing file located under the public_html of any account.

If you access the URL as example.com/php.ini then it will show the configuration file with all the configuration settings done for the php.ini of the domain and which also have the changes to get hacked because the contents of the php.ini as visible with the simple URL itself, but if you want to hide the php.ini being located there then you need to add some of the codes into the .htaccess

For example for the php.ini

#vi .htaccess (at the end of the file add the codes)

(For the file, put the code as )

<Files php.ini>
order allow,deny
deny from all
</Files>

(For the folder, put the code as)

<Directory php.ini>
order allow,deny
deny from all
</Directory>
:wq!
(Save and Quit)

And then try to access the URL example.com/php.ini you will get the forbidden error message for the same

Thats it, Done !

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

5 Ways to Get a User’s Disk Usage

This may seem pretty simple, but I see a lot of questions about how to get a user’s disk space...

500 Internal Server Error help

First remember that “Internal Server Error” does not mean a server problem. It implies an...

Adjust Email Quota

If you need to adjust your email mailbox quota, you can do so from within your cPanel account.1)...

Changing an FTP User’s Path

By default, your main FTP (cPanel) user will have and FTP path to the user’s home folder, and...

Common cPanel Commands List

Most Common Linux Cpanel Commands for Server Admins & Cpanel Users .Limit webuser resources...