Search code examples
apache.htaccess

Deny access to one specific folder in .htaccess


I'm trying to deny users from accessing the site/includes folder by manipulating the URL.

I don't know if I have to deny everything and manually make individual exceptions to allow, if I can just deny this one folder, or if there's a rewrite function that can be used.

Specific example: I don't want to see the directory files by typing in localhost/site/includes into the URL.


Solution

  • Create site/includes/.htaccess file and add this line:

    Deny from all