• Resolved Michalooki

    (@michalooki)


    Is it possible to prevent woocommerce from creating the htaccess file in woocommerce downloads folder?
    we need this folder to have the same permissions as the regular dowloads folder
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Claudio Sanches

    (@claudiosanches)

    Hello @michalooki,

    It’s possible with a little of code, like you can disable stop this file to getting created during WooCommerce’s installation with:

    add_filter( 'woocommerce_install_skip_create_files', '__return_false );

    
    
    But note that while saving the settings this file gets created again because WooCommerce wants to ensure that files are protected, anyway you can automatically remove it after gets created with:
    
    

    add_action( ‘woocommerce_settings_saved’, function() {
    $upload_dir = wp_get_upload_dir();
    $file_path = $upload_dir[‘basedir’] . ‘/woocommerce_uploads/.htaccess’;

    if ( file_exists( $file_path ) ) {
    unlink( $file_path ); // Remove file.
    }
    });
    `

    You sound like someone that know what’s doing, but I’ll alert anyway in case someone else find this thread, please use those code carefully and check if people can’t browser your downloads or access directly or find those files on Google.

    I hope it helps you.

    Thread Starter Michalooki

    (@michalooki)

    Thanks for your reply Claudio, I will check it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘woocommerce uploads folder premissions’ is closed to new replies.