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 Protect the htaccess File

Protect your .htaccess file from public access with one rule. Step-by-step for websites hosted with KickHost, serving customers in Kenya.

Share

The .htaccess file controls redirects, security rules and caching for your website, so it should never be readable by visitors. Most servers already guard it, but adding an explicit rule gives you a second layer of protection. This guide shows the rule and where to put it.

You can prevent unauthorized access to your htaccess file by adding this rule to the file:

# .htaccess protection order allow, deny
deny from all
satisfy all

Before you edit .htaccess

The file sits in the main folder of your website (usually public_html) and is hidden by default. In cPanel File Manager, open Settings and tick Show Hidden Files so you can see it. Download a copy before you change anything, because a small typing mistake can take a website offline with a 500 error. If that happens, restore your copy and try again.

How to check the rule works

After saving, open yourdomain.co.ke/.htaccess in your browser. You should see a “403 Forbidden” message instead of the file contents. Visitors still reach the rest of the website as normal.

If the rule gives an error

Some servers use newer Apache or LiteSpeed syntax. If your site shows an error after adding the rule, remove it and contact support so we can suggest the correct version for your server.

Frequently asked questions

Do I need this rule on every website? Many hosting servers already block direct access to .htaccess, but the rule does no harm and is useful if you ever move to a server with different defaults.

Where is my .htaccess file? It is in the folder your domain points to, normally public_html. Turn on Show Hidden Files in File Manager to see it.

Will this stop my website from working? No. The rule only blocks people from reading the .htaccess file itself. Your pages and redirects continue to work.

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