Sometimes, when developing a site or in special configurations, it is required to restrict access to certain parts of the site, deny access to them for anonymous users, and provide password access.
In the PHP hosting control panel, it is possible to set rules for access to site folders using Basic authentication.
To configure access:
Settings should be done in the PHP hosting control panel https://cloud.realhost.pro
1. Go to the WWW - WWW domains section
2. Select a site and click the Access button
3. In the access editor, click the Add button
4. Specify the folder to which you want to restrict access
5. Enter the username and password of a user with access to this folder
When the URL is called without authorization, the web server will return a 401 access error.
$ curl -I http://mysite.com/securefolder/ HTTP/1.1 401 Unauthorized Server: nginx/1.18.0 Date: Tue, 24 Aug 2021 09:10:56 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive WWW-Authenticate: Basic realm="Access limited by ISPmanager"