• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_get_htaccess_rules() – Retrieve the .htaccess rules to wp-content/uploads/edd/

You appear to be a bot. Output may be restricted

Description

Retrieve the .htaccess rules to wp-content/uploads/edd/

Usage

$mixed|void = edd_get_htaccess_rules( $method );

Parameters

$method
( bool ) optional –

Returns

mixed|void The htaccess rules

Source

File name: easy-digital-downloads/includes/admin/upload-functions.php
Lines:

1 to 28 of 28
function edd_get_htaccess_rules( $method = false ) {

  if( empty( $method ) )
    $method = edd_get_file_download_method();

  switch( $method ) :

    case 'redirect' :
      // Prevent directory browsing
      $rules = "Options -Indexes";
      break;

    case 'direct' :
    default :
      // Prevent directory browsing and direct access to all files, except images (they must be allowed for featured images / thumbnails)
      $allowed_filetypes = apply_filters( 'edd_protected_directory_allowed_filetypes', array( 'jpg', 'jpeg', 'png', 'gif', 'mp3', 'ogg', 'webp' ) );
      $rules = "Options -Indexes\n";
      $rules .= "deny from all\n";
      $rules .= "<FilesMatch '\.(" . implode( '|', $allowed_filetypes ) . ")$'>\n";
          $rules .= "Order Allow,Deny\n";
          $rules .= "Allow from all\n";
      $rules .= "</FilesMatch>\n";
      break;

  endswitch;
  $rules = apply_filters( 'edd_protected_directory_htaccess_rules', $rules, $method );
  return $rules;
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th January 2022

Primary Sidebar

Information

Function name: edd_get_htaccess_rules
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/admin/upload-functions.php
File ref: includes/admin/upload-functions.php
Deprecated?: No
API Letters: E,G,H,R

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites