Password protecting a directory on cPanel


Password protecting a directory on cPanel


Password protecting a directory restricts access to certain parts of your website by requiring visitors to enter a username and a password. This password process is also referred to as a type of “authentication” process.

cPanel Password Protect Directory icon.

(cPanel >> Security >> Password Protect Directories)

You can manually create password protect by using the following steps.

Create .htpasswd file for users and passwords:

htpasswd -c /path/to/file/.htpasswd username

This command will prompt you for the password.

Edit .htaccess:

AuthName “Members Only”
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
require valid-user
deny from all

You can protect more than one file by using wildcard names. On the FilesMatch line, follow one of these examples:
<FilesMatch “*.php”>
<FilesMatch “file.*”>
<FilesMatch “*.*”>

example

<FilesMatch “*.php”>
AuthName “Member Only”
AuthType Basic
AuthUserFile /home/cpanelusername/.htpasswd
require valid-user
</FilesMatch>

Bu cevap yeterince yardımcı oldu mu?

Diğer Dökümanlar


  • What is cPanel and how to access it?

    CPanel is a fully featured web-based control panel that allows you to manage your domain through a web interface. cPanel gives you complete control over a vast amount of functions, streamlining...

  • CloudFlare Plugin install on cpanel

    CloudFlare is a performance and security service. With 14 points of presence around the world, a website on CloudFlare typically loads twice as fast, uses 65% less server resources, saves 60% of...

  • Enable Cronjob in cpanel and examples

    What is cron? It is the scheduling daemon of the Linux operating system Cron jobs allow you to automate repetitive tasks on the server that hosts your web site. This is a powerful tool that allows...

  • What is Anonymous FTP and how to enable it

    Anonymous FTP allows you and others that you give permission to, to access your “public_ftp” folder. There are two options available: 1. ftp://ftp.yourdomain.com –This allows...

  • Unable to connect cpanel using IP/whm and IP/cpanel

    If cpanel cannot be accessed using IP/whm and IP/cpanel, but can be accessed using IP:2086 and IP:2082, then here goes the solution for the same. The reason for this issue due to missing some...