Your country & currency

Make yourself at home. Choose your preferred shopping currency.

Your selected country opens its KickHost website. Your shopping currency is saved. Visit country website .

Guide

How to Disable Directory Browsing Using the htaccess Rule

Turn off directory browsing so visitors cannot list your website files. Quick .htaccess guide for KickHost hosting customers in Kenya.

Share

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.

For security purposes, you should disable directory browsing on your website so no one can see the files/directories of your website.

You can disable Directory Browsing by adding the below line to your dot htaccess file.

Options -Indexes

Where to add the line

Open the .htaccess file in your website’s main folder (usually public_html), add the line on its own row, and save. Enable Show Hidden Files in cPanel File Manager if you cannot see the file. Keep a backup copy in case you need to undo the change.

How to test it

Visit a folder on your site that has no index file, for example yourdomain.co.ke/wp-content/uploads/. With directory browsing off you should get a “403 Forbidden” page instead of a list of files.

Other good habits

Keep an empty index.html in sensitive folders, remove old backups from public folders and keep WordPress, themes and plugins up to date.

Frequently asked questions

Does this affect my website pages? No. Pages, images and scripts load as normal. Only the automatic file listing for folders without an index page is switched off.

Is directory browsing on by default? It depends on the server. Many hosts turn it off, but adding the rule makes sure it stays off.

Why do I see a 500 error after adding the line? Check for typing mistakes or extra characters, or restore your backup. If it continues, contact support.

Related guides

Need cPanel hosting in Kenya? See KickHost hosting plans or contact our team.

Found this useful? Share it.

Need a hand with this?

Our team can help you choose the right domain, hosting or server and set it up properly.

Talk to our team See hosting plans