htaccess that hides only directories

Asked

Viewed 222 times

4

I created a directory assets in order to place the Assets of my project.
So far so good, however, I found that when typing in the URL localhost/project/assets, it shows the directory structure of that folder. In order to prevent this action, I created a file .htaccess in the directory assets:

Deny from all

Create the .htaccess as above prevented the view of the directory, but caused an error: no file being CSS or Javascript is loaded from this folder.

So my question is:
There is a way to hide only the directories, leaving visible and their respective files for my own application?

1 answer

3


Just try this on your file .htaccess:

Options -Indexes
  • Thank you very much, Leonardo! It worked perfectly. ^-^

  • 1

    Not at all. You can click the tick ("v") below the answer and it will be marked as accepted. Thus, it is documented to others who come to access the site that the answer has solved your problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.