Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Linux Protected Web Directories With .htaccess

Protected Web Directories With .htaccess

The phpMyAdmin folder or admin (administration) folder should already have a log in form that forces people enter their valid username and password to access the dashboard. However, you may need a second level of protection to ensure your system is safe and secure.

Protected Web Directories or Password Protect module is always available in Control Panel supported by almost popular hosting provider. If you can’t find where is it or don’t know how to do it, let follow steps below. You need to have access to your hosting and familiar with secure shell command.

Steps to setup Protected Web Directories with .htaccess


1. Log in to your account via SSH and jump to the folder you want to protect

2. Create a file name called .htpasswd and grant access

This file will contain username which is granted access to this protected folder and encrypted password.

Type the command below:

[text] htpasswd -c .htpasswd user1
[/text]

After press enter, you will be prompted to enter the password for user: user1 then re type the password to confirm. If the passwords are matched, a .htpasswd file will be created with content similar to:

[text] hoanhuynh:vfWdjKLO5bzAA
[/text]

If you want to add more, simple re use the command above without -c:

[text] htpasswd -c .htpasswd user2
[/text]

3. Create or modify the .htaccess file

You can use your favorite FTP client to create or upload a .htaccess file to the folder you want to protect with few lines below:

[text] AuthUserFile /enter/location/of/.htpasswd
AuthGroupFile /dev/null
AuthName PleaseLogin
AuthType Basic

require user user1
[/text]

The content above will allow username user1 to access to the protected folder. And you need to update the location of the .htpasswd file we created on step 2.

Aug 6, 2011Hoan Huynh
Websites Hosted On A Web Server With IP AddressDownload Microsoft Movie Maker - The Best Movie Maker For Bloggers
You Might Also Like:
  • Fix session_start() open(/tmp) failed Permission Denied With .htaccess, ini_set and php.ini
  • HTTP/ HTTPS Document, CGI-BIN And Access/ Error Logs On cPanel, Plesk And VirtualMin
  • Free Software To Monitor and Log Directories Files Changed On Windows 2000 XP 2003 Vista 7 Server 2008
  • PHP Completely Delete A Directory Include Sub Directories And Files
  • Upgrade/Switch To PHP 5.0 5.1 5.2 5.3 With .htaccess
  • Manage MacBook Hosts File Easier With Hosts Widget
  • Jquery checkbox checked
  • PHP Delete File Function
  • Get Image Width Height With JQuery And JavaScript
  • How To Track Website With Multiple Google Analytisc Accounts
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago Linuxhtaccess, htpasswd74
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,168 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,044 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,824 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,306 views
C# Read Json From URL And Parse/Deserialize Json
9,794 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • How to Compose Your Essay To Me – 4 Easy Steps to Write My Essay
  • How to Find a Photo Editor
  • Installment Loans – Making Sense of Online Software
  • Apple Pay Casino Canada
  • Casinos austria
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (105)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development