How do I hide and show the files and directories on my website?

Linode Staff

When I go to example.com, I see all the files on my website instead of a 404 or 403 error. How can I disable this? Also, how do I enable this?

1 Reply

The feature you are looking for is mod_autoindex in Apache. You can read the full documentation here, but in a nutshell, you want to add

Options -Indexes

to your Apache virtual host configuration in the directory you want to disable. To enable them, you want to use

Options +Indexes

In Nginx, the equivalent is ngx_http_autoindex_module. You can read the full documentation on this here. While it is set to off by default, you can explicitly turn it on/off with the following inside a location block of your virtual host configuration:

autoindex off;

To enable it, you would use

autoindex on;

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct