1

I have problem I'm using my folder as 'includes' and there are all files with extension .php so I wanna block this folder, when someone "hacker" want to write in url path to for instance file responsible for connection to database. But other files can using this files to make a diffrent operations.

  • Does this answer your question? [Deny access to one specific folder in .htaccess](https://stackoverflow.com/questions/19118482/deny-access-to-one-specific-folder-in-htaccess) – MrWhite Oct 26 '21 at 22:02

1 Answers1

1

inside your "includes" directory create a file ".htaccess" with a row "deny from all". It will prevent browser access to your files inside Includes directory.

esqeudero
  • 102
  • 2
  • 9
  • `deny from all` is an Apache 2.2 directive and formerly deprecated on Apache 2.4. On Apache 2.4 you should be using `Require all denied` instead. (But you should also ensure you are using the new directives throughout.) – MrWhite Oct 24 '21 at 00:09
  • But this I think it is working for all access. I will can not use this files to do sth. I wanna only block url path to folder 'includes' with files. – MaxPayne420 Oct 24 '21 at 10:51
  • It will prevent access to "includes" directory only from URL path. You can try it. After implementing it, first try to access from browser, it will prevent. Second, try to access with cronjob or shell, it should work. – esqeudero Nov 02 '21 at 14:27