Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileSecurity.php

function FileSecurity::htaccessLines

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::htaccessLines()

Returns the standard .htaccess lines that Drupal writes.

Parameters

bool $deny_public_access: (optional) Set to FALSE to return the .htaccess lines for an open and public directory that allows Apache to serve files, but not execute code. The default is TRUE, which returns the .htaccess lines for a private and protected directory that Apache will deny all access to.

Return value

string The desired contents of the .htaccess file.

See also

file_save_htaccess()

1 call to FileSecurity::htaccessLines()
FileSecurity::writeHtaccess in composer/Plugin/VendorHardening/FileSecurity.php
Writes an .htaccess file in the given directory, if it doesn't exist.

File

composer/Plugin/VendorHardening/FileSecurity.php, line 48

Class

FileSecurity
Provides file security functions.

Namespace

Drupal\Composer\Plugin\VendorHardening

Code

public static function htaccessLines($deny_public_access = TRUE) {
    $lines = static::htaccessPreventExecution();
    if ($deny_public_access) {
        $lines = static::denyPublicAccess() . "\n\n{$lines}";
    }
    return $lines;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal