{"id":18442,"date":"2026-09-30T08:58:31","date_gmt":"2026-09-30T05:58:31","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/disable-directory-listing-cpanel\/"},"modified":"2026-11-22T13:55:30","modified_gmt":"2026-11-22T10:55:30","password":"","slug":"disable-directory-listing-cpanel","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/disable-directory-listing-cpanel\/","title":{"rendered":"Stop Your Website Files Being Listed in the Browser with Indexes in cPanel"},"content":{"rendered":"<div class=\"hkb\" dir=\"ltr\">\n<div class=\"hkb-tldr\"><b>In short<\/b>Open <b>Indexes<\/b> in cPanel, click <b>Edit<\/b> next to <code>public_html<\/code>, choose <b>No Indexing<\/b> and click <b>Save<\/b>. Any folder without an index file then shows an access denied message instead of a file list.<\/div>\n<div class=\"hy-vid\"><div style=\"width: 1280px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-18442-1\" width=\"1280\" height=\"720\" poster=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-indexes-en.jpg\" preload=\"none\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-indexes-en.mp4?_=1\" \/><a href=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-indexes-en.mp4\">https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-indexes-en.mp4<\/a><\/video><\/div><\/div>\n<p>Try opening a link such as <code>yourdomain.com\/wp-content\/uploads\/<\/code> in your browser. If you get a list of file and folder names, your site shows the contents of its folders to anyone. That makes it easy for an attacker to see which plugins you use, or to find a backup you forgot about.<\/p>\n<h2>Why does the list appear?<\/h2>\n<p>The server looks in each folder for a main file such as <code>index.php<\/code> or <code>index.html<\/code>. If there is none and listing is allowed, it shows the file list instead.<\/p>\n<h2>The options in Indexes<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Option<\/th>\n<th>What happens<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Default System Setting<\/td>\n<td>Follows the server or parent folder setting<\/td>\n<\/tr>\n<tr>\n<td>No Indexing<\/td>\n<td>No list is shown and the visitor gets an access denied message. Recommended<\/td>\n<\/tr>\n<tr>\n<td>Show Filename Only<\/td>\n<td>Only file names are listed<\/td>\n<\/tr>\n<tr>\n<td>Show Filename and Description<\/td>\n<td>Names are listed with size and date<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>The steps<\/h2>\n<ol class=\"hkb-steps\">\n<li><b>Open Indexes<\/b> in the Files section of cPanel.<\/li>\n<li><b>Click a folder name to go inside<\/b> or click Edit next to the folder you want.<\/li>\n<li><b>Choose No Indexing<\/b> from the four options.<\/li>\n<li><b>Click Save<\/b> then open the folder link in a browser to check.<\/li>\n<\/ol>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-fd-en-f-index.webp\" alt=\"The Indexes tool in cPanel with Edit buttons for each folder\" width=\"800\" height=\"451\" loading=\"lazy\" \/><\/figure>\n<p>Editing <code>public_html<\/code> is usually enough, because subfolders whose Index Type shows Inherit follow its setting.<\/p>\n<h2>The alternative: one line in .htaccess<\/h2>\n<p>If you manage your own files, add this line to the <code>.htaccess<\/code> file in <code>public_html<\/code>. The tool writes much the same line:<\/p>\n<pre class=\"hkb-code\">Options -Indexes<\/pre>\n<div class=\"hkb-note\">Some sites list files on purpose, such as a public downloads folder. Turn listing on for that folder alone, not for the whole site.<\/div>\n<h2>Related security steps<\/h2>\n<ul class=\"hkb-list\">\n<li>Password protect private folders: <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/password-protect-directory-cpanel\/\">Directory Privacy<\/a>.<\/li>\n<li>Do not leave backups or archives inside <code>public_html<\/code>: <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/exposed-sensitive-files-env-git-backups\/\">exposed sensitive files<\/a>.<\/li>\n<li>Review file permissions: <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/secure-file-permissions\/\">safe file permissions<\/a>.<\/li>\n<\/ul>\n<h2>Frequently asked questions<\/h2>\n<div class=\"hkb-faq\">\n<details>\n<summary>Does No Indexing stop visitors opening the files themselves?<\/summary>\n<p>No, it only hides the list. Anyone with a file&#8217;s link can still open it.<\/p>\n<\/details>\n<details>\n<summary>Will it affect a WordPress site?<\/summary>\n<p>No, pages work as before because they rely on index.php.<\/p>\n<\/details>\n<details>\n<summary>I now see a 403 error on a folder. Is that normal?<\/summary>\n<p>Yes, for a folder without an index file; that is the intended result.<\/p>\n<\/details>\n<details>\n<summary>Where is the setting stored?<\/summary>\n<p>In the .htaccess file inside the folder you edited.<\/p>\n<\/details>\n<\/div>\n<div class=\"hkb-rel\"><b>Related guides<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/password-protect-directory-cpanel\/\">Password Protect a Folder in cPanel (Directory Privacy): Steps, and What It Does and Does Not Protect<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/exposed-sensitive-files-env-git-backups\/\">Exposed Sensitive Files on Your Site: .env, .git and Backups, and How to Hide Them<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/secure-file-permissions\/\">Secure File Permissions for Your Website: When to Use 644 and 755, and Why to Avoid 777<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/how-to-use-file-manager-in-cpanel\/\">cPanel File Manager: Open It, Show Hidden Files, Change Permissions and More<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/cpanel-files-databases-section\/\">The Files and Databases Sections in cPanel: File Manager, FTP and Creating a Database<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.hyyat.com\/en\/kb\/website-control-panel-cpanel\/\">All cPanel guides \u2192<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In shortOpen Indexes in cPanel, click Edit next to public_html, choose No Indexing and click Save. Any folder without an index file then shows an access denied message instead of a file list. Try opening a link such as yourdomain.com\/wp-content\/uploads\/ in your browser. If you get a list of file and folder names, your site [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":20789,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_templately_pack_id":"","_templately_imported_at":"","_templately_source":"","_templately_import_session_id":"","footnotes":""},"doc_category":[2749],"doc_tag":[],"class_list":["post-18442","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-website-control-panel-cpanel"],"year_month":"2026-11","word_count":480,"total_views":"3","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"ahmed fathy","author_nicename":"ahmed-fathy","author_url":"https:\/\/www.hyyat.com\/en\/author\/ahmed-fathy\/"},"doc_category_info":[{"term_name":"cPanel Guides","term_url":"https:\/\/www.hyyat.com\/en\/kb\/website-control-panel-cpanel\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/comments?post=18442"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18442\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media\/20789"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=18442"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=18442"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=18442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}