How to make password protected folder/file using .htaccess

all kinds of tutorials and guides. how, where, why, step-by-step stuff and more. also support for those tutorials and guides. ONLY post step-by-step guides/tutorials here OR reply with question if you have any.
Post Reply
User avatar
Sethioz
Admin
Admin
Posts: 4762
Joined: Fri Jul 27, 2007 5:11 pm
Custom: Gaming YT > https://youtube.com/SethiozEntertainment
Game Hacking YT > https://youtube.com/sethioz
Game Hacks Store > https://sethioz.com/shopz
Location: unknown
Contact:

How to make password protected folder/file using .htaccess

Post by Sethioz »

1. make a file called ".htaccess" and put the following code in it:

Code: Select all

AuthUserFile /full/path/to/your/.htpasswd
AuthType Basic
AuthName "name for your file/folder"
Require valid-user
full path, means that it has to be some like /home/sites/yoursite/ blabla (you need to ask that from your hosting if you don't know)
authname - this is not your username, this is simply a name displayed (password for blabla @ yoursite)

2. now make a file called ".htpasswd" and put your username:password in it.
Note that username has to be encrypted, this can be done with the special .htaccess password generators. like these:
http://www.4webhelp.net/us/password.php
http://www.htmlite.com/HTA006a.php

3. now put both, ".htaccess" and ".htpasswd" into the folder you wan't to protect

Thats all, now when you wan't to enter that folder you need to enter user and pass.
I have also included example files with username as "admin" and password as "test", look below.
Attachments
ht access.rar
(263 Bytes) Downloaded 420 times
Post Reply