Back to Shared Hosting Documentation

    Password Protected Directories

    Secure sensitive directories with password authentication

    What is Directory Password Protection?

    Password protection allows you to restrict access to specific directories on your website. When users try to access a protected directory, they'll be prompted to enter a username and password.

    This feature uses HTTP Basic Authentication, which is different from a website login system. It's enforced at the server level and applies to all files within the protected directory.

    How to Password Protect a Directory

    1Access Directory Privacy

    1. Log in to your cPanel account
    2. Navigate to the "Files" section
    3. Click on "Directory Privacy"

    2Select Directory

    1. Browse to the directory you want to protect
    2. Click on the folder name to select it
    3. Click the "Edit" button

    3Enable Protection

    1. Check the box "Password protect this directory"
    2. Enter a name for the protected directory (this appears in the login prompt)
    3. Click "Save"

    4Create User

    1. After enabling protection, you'll see the user management section
    2. Enter a username
    3. Enter a strong password (twice for confirmation)
    4. Click "Save"

    Managing Users

    You can create multiple users for a protected directory:

    • Add Users: Follow step 4 above to add additional users
    • Delete Users: Click the delete icon next to any user
    • Change Password: Delete the user and recreate with new password

    Common Use Cases

    /admin

    Protect administrative areas

    /private

    Secure client or member-only content

    /staging

    Restrict access to development/testing areas

    /downloads

    Control access to downloadable files

    Important Notes

    • Password protection applies to the selected directory and all subdirectories
    • This is different from website login systems - it's HTTP authentication
    • Use strong passwords to maintain security
    • The protection persists even if you reinstall applications

    Removing Protection

    To remove password protection:

    1. Go to Directory Privacy in cPanel
    2. Navigate to the protected directory
    3. Click "Edit"
    4. Uncheck "Password protect this directory"
    5. Click "Save"

    Troubleshooting

    401 Errors

    Make sure the .htaccess file wasn't modified manually

    Can't Access

    Verify the username and password are correct

    Not Working

    Check that the directory path is correct