Directory Listing seems to be disabled on your server

rootadmin

Administrator
Staff member
#1
To disable directory listing on your website (i.e., prevent visitors from seeing a list of files in a directory if there is no index file like index.html or index.php), you can do so by editing the server configuration file.


Here’s how to disable directory listing on your website:

1. Using .htaccess (for Apache servers)

If your website is hosted on an Apache server (common for many WordPress sites), you can disable directory listing by modifying or creating a .htaccess file in the root directory of your website.


Steps:


  1. Access your website's root directory using FTP or cPanel's File Manager.
  2. If you already have a .htaccess file, open it for editing. If not, create a new one.
  3. Add the following code to the file:
    Options -Indexes


  4. Save the .htaccess file and upload it back to the server if you're using FTP.

Explanation:


  • Options -Indexes tells the Apache server to disable directory indexing, meaning visitors will no longer see a list of files if there's no index file in a folder.

2. Using Nginx (for Nginx servers)

If your website is hosted on an Nginx server, you can disable directory listing by editing the Nginx configuration file.


Steps:


  1. Connect to your server using SSH.

  2. Edit the Nginx configuration file (usually located at /etc/nginx/nginx.conf or within the /etc/nginx/sites-available/ directory).
  3. Find the server block where your site is configured and add or ensure the following line is present:autoindex off;


  4. After adding this, save the configuration file.
  5. Finally, reload Nginx to apply the changes by running the following command:sudo service nginx reload


Explanation:


  • autoindex off; disables the directory listing feature in Nginx, so users will not see the contents of directories without an index file.

3. Using cPanel File Manager (if available)

If you're using cPanel for hosting, you can easily disable directory listing without manually editing files:


  1. Log in to your cPanel.

  2. Go to File Manager and navigate to your website’s root directory.
  3. Look for a .htaccess file (if it’s not there, you can create one).
  4. Right-click the .htaccess file and click Edit.
  5. Add the following line to the file:Options -Indexes

  6. Save the changes.
4. Check Your Website After Making Changes

Once you’ve applied the changes, test your website by navigating to a directory that previously listed its files. You should now receive a 403 Forbidden error or a 404 Not Found error (depending on your server configuration), rather than seeing a list of files.



By following these steps, you can successfully disable directory listing and enhance your website’s security by preventing users from accessing sensitive files that are not intended for public viewing.
 

rootadmin

Administrator
Staff member
#2
🚀 If you want to team up and earn together

Join our community to share setup tips, optimize PC/VPS earnings, and support each other on the journey to passive income 💻🤝

👉 Join the team here:
https://discord.gg/sVcUTYPyns

Grow faster when you build together 💪🔥
 

More ways to contact me. Advertise your services
Top