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

  • 0

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 !!!


Was this answer helpful?

« Back