i'm using Apache and i have the following folders in the root folder
/images/
/pages/
/storage/
how can i block access to any files in those folders, also blocking access to the directorys above but allow access to only the index.html
file that is located in the root folder?
how is this done in the config file AND .htaccess
file?
You can create a .htaccess file in the root folder and specify the following content inside it:
<Directory /path/to/diretcory>
Order deny,allow
Deny from all
<Directory>
Or, create a file for each directory containing this content:
<Files *>
Order deny,allow
Deny from all
</Files>
This is pretty simple.
Create a .htaccess
file in the root directory with this content:
Order Deny,Allow
Deny from all
<FilesMatch "index.html">
Order allow,deny
Allow from all
</FilesMatch>
This will deny access for everybody. If, though, the requested file is "index.html" then it'll allow access.