KDJ Guru

.htaccess – Protect Your Website with a Password

Read Time57Seconds

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.

kdjguru:$apr1$7G3m3Onp$Q3Wdrf1sgUhpYRjDonp5R.
kdj:$apr1$U5.k3fhc$m1hbXpMnL4SejIUCj2TBI/

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

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

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!

 

2 0

About Post Author

Kavidu Jayakody

Kavidu Dilshan Jayakody is the founder and the author of KDJ Blog. He is a skilled web developer and graphic designer. In addition, he has earned his degree BSc (Hons) Computing, UK. He is working as a tutor of an institute and as a part-time blogger, he will help you all to make your problems solved.
0 %
Happy
0 %
Sad
0 %
Excited
0 %
Angry
100 %
Surprise

2 thoughts on “.htaccess – Protect Your Website with a Password”

  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?
    Thanks

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top