To disable directory indexing in Apache, follow these steps:

  1. Open the Apache configuration file in a text editor. The location of this file may vary depending on your operating system and the installation method you used for Apache. For example, on Ubuntu, the configuration file is located at /etc/apache2/apache2.conf.

  2. Find the directory block that you want to disable indexing for. This block specifies the options and settings for a particular directory on your web server.

  3. Inside the directory block, add the following line:

Options -Indexes

This will disable directory indexing for this directory.

  1. Save the configuration file and restart Apache for the changes to take effect. On Ubuntu, you can restart Apache by running the following command:

sudo systemctl restart apache2

After this, directory indexing will be disabled for the specified directory. Visitors to your website will no longer be able to view a list of files and directories when they access this directory.

how-to-disable-directory-index-in-Apache

原文地址: http://www.cveoy.top/t/topic/fVD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录