Follow this guide step by step with ChatGPT, Claude or another AI

Updated: 30 November 2026 · Applies to: Plesk Obsidian 18.0 for Linux (Apache with nginx) and Plesk Obsidian 18.0 for Windows (IIS); directives tested on Apache 2.4.69 and nginx 1.30.5

To stop visitors seeing a list of your files when a folder has no index page, add Options -Indexes for the site. On Plesk for Linux you can do this in the site's .htaccess file or in Apache & nginx Settings. On Plesk for Windows, clear the Directory browsing checkbox in the site's IIS Settings. With listing off, a request for such a folder returns 403 Forbidden, while the files inside still open normally for anyone who has the exact link.

Why turn directory listing off

A file list shows backups, configuration copies, uploads and old scripts that you never meant to publish, and it helps automated scanners find them. According to Plesk, new sites have directory listing switched off already. If a folder on your site still shows an "Index of /" page, something has switched it on, usually an Options +Indexes line in an .htaccess file or an autoindex on; line in the site's nginx directives.

Plesk for Linux: method 1, the .htaccess file

This works for one site or one folder and needs no access to the server settings.

  1. Log in to Plesk and open Websites & Domains, then Files for your domain.
  2. Open the httpdocs folder (or the folder you want to protect). Create or edit the file .htaccess. See How to Edit Files Directly in Plesk File Manager if you have not used the editor before.
  3. Add this line and save:
    Options -Indexes
  4. If the file already has Options +Indexes or Options Indexes, remove that line, because it switches listing back on.

A rule in httpdocs/.htaccess covers every folder below it. In our Apache 2.4.69 lab test, a folder without an index page returned 200 OK with an "Index of /files" page before the change, and 403 Forbidden after it, while a file inside the folder still returned 200 OK.

Plesk for Linux: method 2, Apache and nginx Settings

Use this when you want the setting outside the website files, so an application update cannot overwrite it.

  1. Go to Websites & Domains and select your domain. In the newer Plesk layout, open the Hosting & DNS tab; then click Apache & nginx Settings.
  2. In Additional directives for HTTP, add:
    <Location />
        Options -Indexes
    </Location>
  3. Add the same block to Additional directives for HTTPS. According to Plesk, these two fields are written to the separate files vhost.conf and vhost_ssl.conf, so a directive in only one of them applies to only one protocol.
  4. Check Additional nginx directives on the same page. If it contains autoindex on;, remove that line (nginx lists folders only when this is set; in our nginx 1.30.5 test a folder without it returned 403 Forbidden).
  5. Click OK or Apply. Plesk checks the configuration and rebuilds it.

The <Location /> wrapper matters: Apache applies Location blocks after Directory blocks, so this setting wins even if a directory rule allows listing. In our test, a folder whose directory rule had Options Indexes still returned 403 Forbidden once the block above was added.

Plesk for Windows (IIS)

  1. Go to Websites & Domains, select your domain and open IIS Settings (on the Hosting & DNS tab in the newer layout).
  2. Clear the Directory browsing checkbox and click OK.

To change a single folder instead of the whole site, go to Websites & Domains > your domain > Virtual Directories, open the folder and click Directory Properties, then clear Directory browsing. According to Plesk, when Use default documents is also off for that folder, IIS returns an "Access Forbidden" error instead of a list.

Administrators can set the same option from the command line on the server, according to Plesk's virtdir.exe reference (where -dir_browsing is false by default):

plesk bin virtdir.exe --update / -vhost example.com -dir_browsing false

Check that it worked

Open a folder that has no index.html or index.php in a private browser window, for example https://example.com/wp-content/uploads/. You should see a 403 or "Forbidden" page instead of a file list. If you still see the list, clear any cache in front of the site (such as a CDN) and look for an .htaccess file in a lower folder that sets Options +Indexes again.

Turning off listing hides file names; it does not protect a file whose address someone already knows. Keep backups and private data out of the web folder altogether.

Official documentation: Plesk: Changing virtual directory settings and Plesk: virtdir.exe.

Related services

Plesk server management

installation, migrations and monthly plans with no lock-in.

cPanel, Plesk and LiteSpeed licences

for VPS and dedicated servers, with installation help on demand.

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Was this answer helpful?

Still stuck? Open a ticket