Preventing the ‘Index Of’ page in .htaccess Updated on June 12, 2025 by Scott Mitchell 1 Minutes, 6 Seconds to Read When working with your site there may be many files or folders. Ideally, most folders should have an index page of some sort. For our servers, they should be one of three names: index.htm, index.html, and index.php. As long as the folder contains at least one file with one of these names, it will display on the screen. If, however a folder does not contain one of these files, then it will simply display a list of all files and folders contained within. This is the default behavior, but you can also change it within the .htaccess file. This article will guide you on how to prevent the list showing, even if the index pages are not in the folder. How to Prevent the Index Of page Log into your cPanel dashboard. Once in the cPanel, click on the File Manager icon, located in the Files category. Locate the .htaccess file and open it for editing. At the top of the file, add the following code: Options -Indexes Save and close the file. Now when someone visits a directory or folder that has no index file, it will receive a 403 Forbidden error instead of seeing a list of the directory’s contents. The 403 error indicates the visitor does not have access permissions to view that area. Professional Websites Without the Tech Headaches Our team will build a beautiful WordPress site and take care of updates, security, and maintenance – so you can focus on running your business. Let Us Handle It for You Share this Article Related Articles How to Edit a Website File on Your Server How to Import a Table Using phpMyAdmin Force HTTPS with the .htaccess File The Complete Guide to cPanel Backups Schedule Social Media Posts With Buffer How to Google Analytics to WordPress Without a Plugin How to Install Jekyll and Launch a New Site FTP Basics for Dedicated Servers What is your default PHP.ini file? How to Fix the Insecure SSL Error due to SHA-1 Deprecation