{"id":50424,"date":"2026-11-20T05:24:09","date_gmt":"2026-11-20T05:24:09","guid":{"rendered":"https:\/\/kickhost.com\/guides\/how-to-disable-directory-browsing-using-the-htaccess-rule\/"},"modified":"2026-11-28T06:06:24","modified_gmt":"2026-11-28T06:06:24","slug":"how-to-disable-directory-browsing-using-the-htaccess-rule","status":"publish","type":"kickhost_tutorial","link":"https:\/\/kickhost.com\/en-ke\/guides\/how-to-disable-directory-browsing-using-the-htaccess-rule\/","title":{"rendered":"How to Disable Directory Browsing Using the htaccess Rule"},"content":{"rendered":"<p>When a folder has no index page, some servers show a list of every file inside it. That can reveal backups, uploads and configuration files you never meant to share. Disabling directory browsing is a simple, effective security step for any website.<\/p>\n<p>For security purposes, you should disable directory browsing on your website so no one can see the files\/directories of your website.<\/p>\n<p>You can disable Directory Browsing by adding the below line to your dot htaccess file.<\/p>\n<pre class=\"language-markup\"><code>Options -Indexes<\/code><\/pre>\n<h2>Where to add the line<\/h2>\n<p>Open the .htaccess file in your website&rsquo;s main folder (usually public_html), add the line on its own row, and save. Enable <strong>Show Hidden Files<\/strong> in cPanel File Manager if you cannot see the file. Keep a backup copy in case you need to undo the change.<\/p>\n<h2>How to test it<\/h2>\n<p>Visit a folder on your site that has no index file, for example <em>yourdomain.co.ke\/wp-content\/uploads\/<\/em>. With directory browsing off you should get a &ldquo;403 Forbidden&rdquo; page instead of a list of files.<\/p>\n<h2>Other good habits<\/h2>\n<p>Keep an empty index.html in sensitive folders, remove old backups from public folders and keep WordPress, themes and plugins up to date.<\/p>\n<h2>Frequently asked questions<\/h2>\n<p><strong>Does this affect my website pages?<\/strong> No. Pages, images and scripts load as normal. Only the automatic file listing for folders without an index page is switched off.<\/p>\n<p><strong>Is directory browsing on by default?<\/strong> It depends on the server. Many hosts turn it off, but adding the rule makes sure it stays off.<\/p>\n<p><strong>Why do I see a 500 error after adding the line?<\/strong> Check for typing mistakes or extra characters, or restore your backup. If it continues, contact support.<\/p>\n<h2>Related guides<\/h2>\n<ul>\n<li><a href=\"https:\/\/kickhost.com\/en-ke\/guides\/how-to-protect-the-htaccess-file\/\">Protect the htaccess file<\/a><\/li>\n<li><a href=\"https:\/\/kickhost.com\/en-ke\/guides\/how-to-block-any-ip-address-via-an-htaccess-rule\/\">Block an IP address with htaccess<\/a><\/li>\n<li><a href=\"https:\/\/kickhost.com\/en-ke\/guides\/how-to-disable-directory-browsing-using-the-htaccess-rule\/\">Disable directory browsing<\/a><\/li>\n<\/ul>\n<p>Need cPanel hosting in Kenya? <a href=\"https:\/\/kickhost.com\/en-ke\/web-hosting\/\">See KickHost hosting plans<\/a> or <a href=\"https:\/\/kickhost.com\/en-ke\/contact\/\">contact our team<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Turn off directory browsing so visitors cannot list your website files. Quick .htaccess guide for KickHost hosting customers in Kenya.<\/p>\n","protected":false},"featured_media":0,"template":"","class_list":["post-50424","kickhost_tutorial","type-kickhost_tutorial","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial"}],"about":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/types\/kickhost_tutorial"}],"version-history":[{"count":3,"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50424\/revisions"}],"predecessor-version":[{"id":53306,"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50424\/revisions\/53306"}],"wp:attachment":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/media?parent=50424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}