'DIrectory resirctions for forbidden and directory listing not working in .htaccess
On my Ubuntu 18.04 server, I am trying to restrict access to a set of files in a directory in apache2 with .htaccess. The webroot is /var/www/app and the directory I want to restrict access is /var/www/app/files. I want any request going into that directory to return 403 , also I want the directory listing to be disabled. Even the user knows the name of the file in that directory, they shouldn't be able to access it whatsoever. I am guessing adding the following lines in the /var/www/app/files/.htaccess should do the job.
Options -Indexes
ErrorDocument 403 "Forbidden"
But when I add this file to the location, it does nothing. Even restarted the service and changed permissions to the .htaccess to www-data. Nothing seems to work. Not sure why.
And I also tried using this to deny access to the directory.
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
Deny from all
</ifModule>
It didn't work either.
Already referred these
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
