This article describes how to create a .htaccess file to control access to a directory. Two examples are provided: the first example denies all access, while the second example allows access only for a specific IP address and denies all other access. The .htaccess file should be uploaded to the directory to be protected using the specified syntax.
To do this, create a .htaccess file with the following syntax and upload it to the directory you want to protect. Below are 2 examples for illustration:
Example 1: Deny all access
<RequireAny>
Require all denied
</RequireAny>
Example 2: Allow access for a specific IP address, deny all other access
<RequireAny>
Require ip x.x.x.x
Require all denied
</RequireAny>