function file_ensure_htaccess

file_ensure_htaccess()

Creates a .htaccess file in each Drupal files directory if it is missing.

Related topics

File

includes/file.inc, line 457
API for handling file uploads and server file management.

Code

function file_ensure_htaccess() {
  file_create_htaccess('public://', FALSE);
  if (variable_get('file_private_path', FALSE)) {
    file_create_htaccess('private://', TRUE);
  }
  file_create_htaccess('temporary://', TRUE);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!file.inc/function/file_ensure_htaccess/7.x