Managing Directory Password Protection in DirectAdmin
Summary
This guide explains how to password‑protect specific folders on your website using DirectAdmin. Directory Password Protection restricts access so only users with valid login credentials can view the protected content.
Overview
Password protection is useful for securing private areas such as admin folders, staging sites, downloads, or internal resources. DirectAdmin automatically creates the required .htaccess and .htpasswd files for you.
Requirements
- DirectAdmin user-level access
- A domain hosted on the server
- The directory you want to protect must already exist
Step-by-Step Instructions
1. Access Directory Password Protection
- Log in to DirectAdmin
- Go to Advanced Features → Password Protected Directories
- Select the domain you want to manage
2. Choose a Directory to Protect
- Browse the folder list
- Click the directory you want to secure
- Click “Protect”
3. Set Protection Details
- Enter a name for the protected area (example: Admin Panel)
- Click “Save”
This creates the protection rules.
4. Create Authorized Users
- After enabling protection, click “Add User”
- Enter a username
- Enter a password
- Save the user
You can add multiple users if needed.
5. Remove a User
- Go to the protected directory
- Find the user in the list
- Click “Delete”
- Confirm removal
6. Disable Protection
- Open the protected directory
- Click “Disable Protection”
- Confirm the action
This removes the .htaccess protection rules.
Common Use Cases
Protect Admin Areas
- /admin
- /private
- /staff
Secure Staging or Development Sites
- /staging
- /dev
Restrict Access to Downloads
- /downloads
- /clients
Troubleshooting
Password Prompt Not Appearing
- Ensure the directory exists
- Check for conflicting .htaccess rules
- Confirm protection is enabled in DirectAdmin
Password Always Incorrect
- Recreate the user with a new password
- Avoid special characters that may break .htpasswd formatting
Protected Directory Shows 500 Error
- The .htaccess file may contain invalid syntax
- Remove custom rules and re-enable protection
Protection Not Working on Subdirectories
- Only the selected directory is protected
- Apply protection to each subdirectory if needed
Related Articles
- Custom Error Pages
- Apache Handlers
- MIME Types
- PHP Settings
- Cron Jobs