You are here

protected static function FileSecurity::denyPublicAccess in Drupal 10

Same name in this branch
  1. 10 composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::denyPublicAccess()
  2. 10 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::denyPublicAccess()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::denyPublicAccess()
  2. 9 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::denyPublicAccess()

Returns htaccess directives to block all access to a given directory.

Return value

string Apache htaccess directives to block access to a location.

File

core/lib/Drupal/Component/FileSecurity/FileSecurity.php, line 87

Class

FileSecurity
Provides file security functions.

Namespace

Drupal\Component\FileSecurity

Code

protected static function denyPublicAccess() {
  return <<<EOF
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
  Deny from all
</IfModule>
EOF;
}