How to Password Protect a Directory in DirectAdmin #
Want to allow only specific users access to a directory on your account? DirectAdmin includes a tool to password-protect any directory — commonly used for staging areas, private client files, or an extra layer of login security.
How to Password Protect a Directory #
- Log in to your DirectAdmin control panel by accessing https://yourdomain:2222
- Navigate to Password Protected Directories
- Click the Find a Directory to Password Protect link. The file manager window will open.
- Locate the folder you want to block access to and click the Protect link
- Enter a description for this protection (like my private directory), a username, and a password.
- Check the Protection Enabled option and click the Save button. You will see a confirmation message: Directory Protection Settings have been saved.
A Note on Protecting WordPress’s wp-admin Folder #
Password-protecting `wp-admin` is a common way to add an extra login layer to WordPress. However, `wp-admin` also contains `admin-ajax.php`, which many themes and plugins use for front-end features (like search, forms, or “load more” buttons) — even for visitors who aren’t logged in. Protecting the whole folder can silently break these features.
To avoid this, add an exception for `admin-ajax.php` in your `.htaccess` file so it stays publicly accessible while the rest of `wp-admin` remains protected. Contact us if you’d like help configuring this safely.