Introduction
In today's article, I will guide you, How to block all PHP files in a particular folder in cPanel. So let's get started.
- First go to your cPanel account, and then login.
- After that, find out the “Files” section, In which you can see the “File Manager” option.
- Simply click on it, and then go inside to the public_html.
- Now go inside to that folder, which you want to block the all PHP files.
- So now find out the ".htaccess" file, Basically this is a Hidden file, for seeing it, simply click on "settings" option, and then select "Show Hidden Files" option, and then click on this "save" button, So now here you can see all hidden files will appear.
- Now select the ".htaccess" file and then right click on it.
- Here you can see the "Edit" option, So simply click on it, and then a popup box will appear.
- Again, click on this "edit" button, and then you will be redirected to a new page.
- On this page, enter the following code inside the file, and then click on this "Save" Changes button.
- RewriteRule ^.*\.php$ – [F,L]
- Now, if you search this directory through your website, then it will show the 404 Error.