• Resolved crimsonhack

    (@crimsonhack)


    When I activate the “LOCK AND PROTECT SYSTEM FOLDERS” function, it conflicts with a plugin for viewing PDF files, displaying a 403 error instead of the file.

    Is there any way to whitelist that specific plugin to make it work properly?

    The plugin is called PDF.js Viewer

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kuzmanstoyanov

    (@kuzmanstoyanov)

    Hello @crimsonhack,

    The feature is adding a security rule in .htaccess in the following folders:

    wp-content/
    wp-includes/
    wp-content/uploads/

    Depending on the folder where the file is located, there are different filters you can use to exclude it. They are all described under the Lock and Protect System Folders section on this page.

    In this particular case, the file which is blocked by our plugin is wp-content/plugins/pdfjs-viewer-shortcode/pdfjs/web/viewer.php. Here is how to whitelist it:

    1. Make sure Lock and Protect System Folders feature is disabled
    2. Add the following filter in the functions.php file of the active theme:

    add_filter( 'sgs_whitelist_wp_content' , 'whitelist_file_in_wp_content' );
    function whitelist_file_in_wp_content( $whitelist ) {
            $whitelist[] = 'viewer.php';
            return $whitelist;
    }

    3. Activate Lock and Protect System Folders feature

    Reactivating the feature in SiteGround Security settings will ensure that the list of the excluded scripts will be updated.

    Best regards,
    Kuzman Stoyanov

    Thread Starter crimsonhack

    (@crimsonhack)

    Thank you very much, it works perfectly!

    Maybe it would be interesting to put an option to easily create whitelists from the interface in future updates.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Whitelist plugin’ is closed to new replies.