Preventing the ‘Index Of’ page in .htaccess Scott MitchellUpdated on June 12, 2025 1 Minute 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 Summarize and Research with AIShare on Social Media Related Articles Enable HSTS in Cloudflare for Stronger SSL Security How to Enable DNSSEC with Cloudflare Configuring Jetpack to work with Cloudflare AutoSSL with Cloudflare Enable Under Attack Mode in Cloudflare How to Set Up Cloudflare with InMotion Hosting How to Verify Your Website With Google Search Console How to Create Your Own Git Server How to Keep Regular Backups for Reseller Accounts How to Cancel Your Backup Manager Subscription