Learn how to prevent executing php file in a particular Folder / Directory!

Today we are going to see how to prevent executing PHP file / PHP code in a particular Folder. This is really important if you have an Upload file option in your website. Upload option could be any file or only image file etc., But it is always better to prevent parsing PHP code in a particular directory.

Lets take an instance:

You have an upload file script and the files are getting stored in a folder called ‘uploads

To prevent parsing PHP file only in the folder ‘uploads‘, all you have to do is put a .htaccess file with the below code inside the folder:

This code dose not allow any PHP code to parse only inside the folder. This is really important and useful in the case of prevent hacking your website!.

Add a Comment

Your email address will not be published. Required fields are marked *