How to Protect Any Directory in a Web Hosting

Safety is a very important factor that we must take care of at all levels. It does not matter what type of device or operating system we are using. Nor if it is a web server. We are going to talk about this in this article. We are going to explain what steps we must take to protect a directory on our web hosting . A way to add an extra layer of security to our site and prevent our folders from being unprotected.

How to encrypt a directory on web hosting

The hosting where we have our website hosted has a large number of folders and subfolders. These directories allow visitors to see the web once they enter. They are also used to manage content, change some parameters, delete and modify files …

Protect Any Directory in a Web Hosting

There are folders that are essential for the proper functioning of the page. Any deleted or modified file could mean that we cannot enter normally and that the page works correctly. Hence the importance of taking into account the encryption of a web hosting directory .

How do we protect a directory on our website? The process is simple. To do this, the first thing we have to do is enter the control panel, which would be cPanel or Plesk, for example. Once we are inside we must go to the Files section, where we will see the Privacy section of the directory.

Entrar a los archivos de un hosting

There we will find the main folders that are in our hosting. For example, as we see in the image below, we will see the folder etc, logs, mail, public_html, public_ftp … We can click on the folder, its icon, and open it. We can also simply click on the name and the selected folder will open.

Privacidad del directorio web

* Note: it must be taken into account that these options could change depending on the hosting that we have contracted. However, the main steps are going to be similar.

When entering the corresponding folder we will see different sections that we can add. We can create a username and password to encrypt that specific directory with a password. You must check the box “The password protects this directory.” It also allows us to give a name to the directory that we are protecting.

Poner contraseña directorio hosting

You simply have to fill in what it asks for and we click Save. In this way we will have correctly protected that folder of our hosting. We can carry out the same process with any other directory that we are interested in protecting with a password and keeping it more secure.

How to set a password to a section of the web

It may be the case that for some reason we are interested in password-protecting a specific section of our page. For example, if we have different sections, such as a store, information articles, forums … We want something in particular to need a password to be displayed.

To achieve this we can encrypt the directory corresponding to that part of the page that we want to encrypt and that has a key. We have to log in to the control panel, go to the Files, Privacy section of the directory and there look for the public_html folder. It is there where everything that is visible to users is concentrated. They are the directories and subdirectories that we can encrypt if we want.

We have to click on the one that interests us and carry out the same procedure that we explained previously. You have to add a password and protect the folder . When a visitor accesses that particular part of the page, they will be asked for a username and password. This way we can prevent some content from being available to anyone.

In short, by following these steps that we have explained, we can protect a directory on our hosting. We can add a password to any folder we have on the server. One more way to improve security and prevent content from being available to anyone who does not have access. Maintaining security is a fundamental factor for all types of systems and devices that we use and it is also something to take into account on a web page.