Welcome back to KDJ Guru. This post is about protecting your website using .htaccess password. However, we can use .htacess to protect access to directories. Sometimes, some files can be private and some of them can be accessed by a set of group. Anyway, we can make each file in a directory with password protection.

first, we need to make a file with the name ‘.htpwd’ in you directory with the following usernames and passwords. However, you have to make your own and replace them. Click here to make your own usernames and passwords.


Then paste the following code into your .htaccess file. If you don’t have a .htaccess file, you have to make it first.

[code]AuthName “KDJ Guru Admin”
AuthUserFile /xampp/htdocs/sample/.htpwd
AuthType Basic
require valid-user[/code]

Then you must replace the bolded text with your file path.

I hope, this tutorial will surely help you to protect your website with a password. Just remember to encrypt your passwords with the above generator. Have a nice day!



  1. Hey there! This is kind of off topic but I need some guidance from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but
    I can figure things out pretty fast. I’m thinking about setting up
    my own but I’m not sure where to begin. Do you have any points or suggestions?

  2. Pingback: Google

Write A Comment