How to block all PHP files in a particular folder/directory in cPanel?

Hello Friends!!!

How to block all PHP files in a particular folder/directory in cPanel?  [Important| Revised 2019]

Here in this tutorial we will get a permanent solution of how to Disable PHP file in any Directory via .htaccess

Follow these simple steps to disable/block any PHP file in any directory via .htaccess [Updated May 2019]

 step::1 Login to your cPanel

step::2 Open File Manager section

How to block all PHP files in a particular folder/directory in cPanel
How to block all PHP files in a particular folder/directory in cPanel
step::3 Go inside public_html
step::4 Go inside “rohan”(is my directory, you can go to any of your directory)
step::5 Now create .htaccess file inside your directory or you can simply edit it if you already have
step::6 Now write the given code in the .htaccess file to block any php file
How to block all PHP files in a particular folder/directory in cPanel| cheapest linux hosting provider redserverhost
How to block all PHP files in a particular folder/directory in cPanel

RewriteRule ^.*\.php$ – [F,L]

Now check the Directory URL from from new Private window

As soon as you hit that URL you will get a 403 Forbidden error

cheapest linux hosting provider
How to block all PHP files in a particular folder/directory in cPanel

And at the same time my website is working fine because i have disallowed a particular directory with this code not the whole website.

redserverhost cheapest linux hosting provider
How to block all PHP files in a particular folder/directory in cPanel

So I guess now you have clearly understood how this code works!!!

Hope this helps you!!!!

 Thanks for reading!!!
Scroll to Top