+91 - 9161069102 support@megaacshost.com

How to protect PHP file execution in a specific directory(step by step guide)

How to protect PHP file execution in a specific directory(step by step guide)

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

MEGA ACS HOST

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

MEGA ACS HOST

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

MEGA ACS HOST

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

MEGA ACS HOST

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

MEGA ACS HOST

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

MEGA ACS HOST

Step::7 Add this below code

<Files *.php>
    Order deny,Allow
    Deny from all
</Files>
MEGA ACS HOST

Step::8 Next Save Changes tab.

MEGA ACS HOST

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

Leave a Reply

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