Verwaltung von Cookies, die für die Werbung verwendet werden, wie z. B. Anzeigenpersonalisierung, Remarketing und Analyse der Anzeigenleistung.
2.7.1.1.5. Restrict access to files and directories with username and password
Important points:
- Access restriction directives should be placed in the .htaccess file located in the protected directory.
- If you plan to use .htaccess to configure access to static files and HTML pages, remove their file extensions from the list of static files.
- Alternatively, you can set a password using the file manager.
Restrict access to directory
require valid-user
Authname "Basic Auth"
Authtype Basic
AuthUserFile "/home/account_name/.htpasswd"
The .htpasswd password file is a simple text file with the following structure:
user1:password
user2:password
Where userX — user's login, password — their encrypted password.
It is recommended that you place this file in a directory that is not accessible via a browser (outside the site directory).
You can generate passwords here. You can encrypt the generated passwords here.
Access to specific file only
require valid-user
Authname "Protected"
Authtype Basic
AuthUserFile "/home/account_name/.htpasswd"
<Files page.php>
allow from all
satisfy any
</Files>
Where page.php is the file that must be accessible in a restricted directory.
Access only to files with specific file extension
require valid-user
Authname "Protected"
Authtype Basic
AuthUserFile "/home/yourlogin/.htpasswd"
<Files *.cfg>
allow from all
satisfy any
</Files>
Where .cfg is the file extension for files that will be accessible in the restricted directory.
Access only to files with specific set of extensions
require valid-user
Authname "Protected"
Authtype Basic
AuthUserFile "/home/yourlogin/.htpasswd"
<FilesMatch ".(gif|bmp|tiff|swf|flv)$">
allow from all
satisfy any
</FilesMatch>
Where gif, bmp, tiff, swf, flv are the file extensions that will be accessible in the restricted directory.