In this post, we will explain to you how to disable PHP file execution in a specific directory using the .htaccess file. By default some of the writable directories cause your site to become vulnerable to hacker attacks. Hackers can use the function to upload backdoor access files or malware to your website.
It is of critical importance that you understand what you are doing before disabling any PHP execution. Doing this will ensure that no PHP file will run in those specific directories. However, if you need to disable PHP execution for a particular directory, you will need to create the .htaccess file.
Step::1 First of all login to your cPanel and then select File Manager section

Step::2 Then now select the public_html and then open the directory where you want to disable PHP execution

Step::3 After you are in a that directory, now click to + File icon located in left corner.

Step::4 Now Create a .htaccess file ( .htaccess file is already present in the directory)

Step::5 Next right click on htaccess file and then select the Edit option

Step::6 Next you can see a pop-up. Next Click Edit and a now new tab will open

Step::7 Add this below code
<Files *.php>
Order deny,Allow
Deny from all
</Files>

Step::8 Next Save Changes tab.

In this method you could protect php execution in a specific directory.
Thanks for Reading this Post !!!
If you’re looking for cheap web hosting. Please Contact to MEGA ACS HOST. Shared web hosting started at ₹ 399/Year.
Mega ACS Host: Website:- https://www.megaacshost.com/
Follow Us social media
Facebook Page– https://www.facebook.com/megaacshost/
Twitter Page– https://www.twitter.com/megaacshost