Troubleshooting Common Conflicts: Security Optimizer's 'Lock and Protect System Folders'
Content
Many users of the 'Security Optimizer – The All-In-One Protection Plugin' report a specific type of conflict: features of their website break when the plugin is active, but work perfectly when it's deactivated. A significant number of these issues are traced back to one powerful security feature: Lock and Protect System Folders.
This article explains why this happens and provides the most common solutions to get your site's functionality back without completely sacrificing security.
Why Does This Conflict Happen?
The 'Lock and Protect System Folders' feature is designed to harden your WordPress installation's core directories (`wp-content/`, `wp-includes/`) against unauthorized execution of PHP scripts, a common attack vector. It does this by adding specific security rules to the `.htaccess` files within those folders.
However, some legitimate plugins and themes operate by directly executing PHP files located within these protected folders (e.g., `/wp-content/plugins/some-plugin/includes/ajax-file.php`). When the security feature is active, it blocks access to these files, resulting in 403 Forbidden errors, broken functionality, or blank white screens. This is not necessarily a 'bug' in either plugin, but a compatibility issue arising from how different software interacts.
How to Identify if This is Your Problem
Before proceeding, confirm that 'Lock and Protect System Folders' is the source of the conflict:
- Go to your WordPress dashboard and navigate to SG Security > Site Security.
- Find the 'Lock and Protect System Folders' setting and temporarily disable it.
- Clear your site and browser cache.
- Check if the previously broken functionality now works.
If the issue is resolved after disabling this feature, you've confirmed the source. You can now proceed with the solutions below. Remember to re-enable the feature after testing before applying a permanent fix.
Common Solutions
1. Use the Built-in Whitelist Filters (Recommended)
The most robust solution is to use the PHP filters provided by the Security Optimizer plugin to whitelist the specific file causing the conflict. This allows you to keep the security feature active while excluding the necessary file.
You will need to add a code snippet to your active theme's `functions.php` file. The exact filter you use depends on the location of the blocked file:
- For files in `wp-content/` (most plugins): Use the `sgs_whitelist_wp_content` filter.
- For files in `wp-includes/`: Use the `sgs_whitelist_wp_includes` filter.
- For files in `wp-content/uploads/`: Use the `sgs_whitelist_uploads` filter.
Example: If a plugin like 'TranslatePress' or 'wpDiscuz' has a blocked file at /wp-content/plugins/translatepress-multilingual/includes/trp-ajax.php, you would add the following to your `functions.php` file:
add_filter( 'sgs_whitelist_wp_content', 'whitelist_my_plugin_file' );
function whitelist_my_plugin_file( $whitelist ) {
$whitelist[] = 'plugins/translatepress-multilingual/includes/trp-ajax.php';
return $whitelist;
}
Always use a child theme when modifying theme files to prevent your changes from being overwritten by updates.
2. Modify the .htaccess File Directly (Advanced)
Alternatively, you can add an exception directly to the `.htaccess` file located in the folder where the conflict occurs. For the example above, you would edit the `.htaccess` file in the `wp-content/` directory.
You would add rules to allow access to the specific file. A common rule structure looks like this:
<FilesMatch "trp-ajax.php">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
Warning: Incorrectly editing your `.htaccess` file can break your site. Only attempt this if you are comfortable with server configuration files and always create a backup first.
3. Disable the Feature for a Specific Plugin
If the conflict is with a specific plugin's functionality (e.g., the WooCommerce app requiring XML-RPC), you may need to disable the related security feature entirely. For the XML-RPC example, you would go to SG Security > Site Security and disable the 'Disable XML-RPC' option.
This is a less secure option but may be necessary for certain integrations.
Conclusion
Conflicts with the 'Lock and Protect System Folders' feature are a common trade-off between heightened security and plugin compatibility. The recommended approach is to use the provided whitelist filters to create targeted exceptions, allowing you to maintain a strong security posture while ensuring all parts of your website function correctly. Always test changes on a staging site before applying them to your live website.
Related Support Threads Support
-
It seems the plugin is not fully compatible with Elementorhttps://wordpress.org/support/topic/it-seems-the-plugin-is-not-fully-compatible-with-elementor/
-
403 as result for form actionhttps://wordpress.org/support/topic/403-as-result-for-form-action/
-
White page due to St Security pluginhttps://wordpress.org/support/topic/white-page-due-to-st-security-plugin/
-
403 error displaying pdfhttps://wordpress.org/support/topic/403-error-displaying-pdf/
-
Woocommerce app getting xmlrpc 403 errorhttps://wordpress.org/support/topic/woocommerce-app-getting-xmlrpc-403-error/
-
Sharing Posts on LinkedIn with Siteground Security & Clean Talk pluginshttps://wordpress.org/support/topic/sharing-posts-on-linkedin-with-siteground-security-clean-talk-plugins/
-
Blocks GTranslate rewrite rules in .htaccesshttps://wordpress.org/support/topic/blocks-gtranslate-rewrite-rules-in-htaccess/
-
Security Optimizer + Speed Optimizer problem with cachehttps://wordpress.org/support/topic/security-optimizer-speed-optimizer-problem-with-cache/
-
Rank Math Can Access “htaccess” Filehttps://wordpress.org/support/topic/bug-rank-math-can-access-htaccess-file/
-
The access to that page has been restricted by the administrator of this websitehttps://wordpress.org/support/topic/the-access-to-that-page-has-been-restricted-by-the-administrator-of-this-website-4/
-
Woocommerce app getting xmlrpc 403 errorhttps://wordpress.org/support/topic/woocommerce-app-getting-xmlrpc-403-error-2/
-
wpDiscuz and SG Security Plugin Compatibility Issueshttps://wordpress.org/support/topic/wpdiscuz-and-sg-security-plugin-compatibility-issues/
-
Plugin Conflict with WpDiscuzhttps://wordpress.org/support/topic/plugin-conflict-with-wpdiscuz/
-
The editor has encountered an unexpected error.https://wordpress.org/support/topic/the-editor-has-encountered-an-unexpected-error-45/
-
Widgets page is blank & white. Disable SG Security plugin fixes it.https://wordpress.org/support/topic/widgets-page-is-blank-white-disable-sg-security-plugin-fixes-it/
-
Redirected to 404 on Logouthttps://wordpress.org/support/topic/random-issue-redirected-to-404-on-logout/
-
Website crashed when installing the pluginhttps://wordpress.org/support/topic/website-crashed-when-installing-the-plugin/
-
Complianz Terms and Conditions PDF File Download Error – 403 – Forbiddenhttps://wordpress.org/support/topic/complianz-terms-and-conditions-pdf-file-download-error-403-forbidden/
-
Cannot Submit Forms in Incognito/Private Browsinghttps://wordpress.org/support/topic/cannot-submit-forms-in-incognito-private-browsing/
-
The editor has encountered an unexpected errorhttps://wordpress.org/support/topic/the-editor-has-encountered-an-unexpected-error-48/
-
Bug with map_meta_cap filterhttps://wordpress.org/support/topic/bug-with-map_meta_cap-filter/
-
create a compare page of SG plugin compared to other WP security plugins.https://wordpress.org/support/topic/create-a-compare-page-of-sg-plugin-compared-to-other-wp-security-plugins/
-
Duplicator Pro vs SG Securityhttps://wordpress.org/support/topic/duplicator-pro-vs-sg-security/
-
Security plugin massively slowing down the websitehttps://wordpress.org/support/topic/security-plugin-massively-slowing-down-the-website/
-
RSS Feed disabled by SG Securityhttps://wordpress.org/support/topic/rss-feed-disabled-by-sg-security/
-
XMLRPC setting needs updating for Apachehttps://wordpress.org/support/topic/xmlrpc-settings-needs-updating-for-apache/
-
Lock and Protect System Folders Issue: blocking a needed scripthttps://wordpress.org/support/topic/lock-and-protect-system-folders-issue-blocking-a-needed-script/
-
Completely remove SG Securityhttps://wordpress.org/support/topic/completely-remove-sg-security/
-
Whitelist pluginhttps://wordpress.org/support/topic/whitelist-plugin-2/
-
It doesnt like Divihttps://wordpress.org/support/topic/it-doesnt-like-divi/
-
Conflict with Divi Builderhttps://wordpress.org/support/topic/conflict-with-divi-builder-12/
-
Not compatible with plugin PDF Posterhttps://wordpress.org/support/topic/not-compatible-with-plugin-pdf-poster/
-
Existing Translation are not showedhttps://wordpress.org/support/topic/existing-translation-are-not-showed/
-
Message when xml-rpc is disabled?https://wordpress.org/support/topic/message-when-xml-rpc-is-disabled/
-
Conflict with Translatepresshttps://wordpress.org/support/topic/conflict-with-translatepress-4/
-
The access to that page has been restricted by the administrator of this websitehttps://wordpress.org/support/topic/the-access-to-that-page-has-been-restricted-by-the-administrator-of-this-website-2/
-
Plugin tries to access to /etc/yum.repos.d/baseos.repohttps://wordpress.org/support/topic/plugin-tries-to-access-to-etc-yum-repos-d-baseos-repo-2/
-
Conflict with GenerateBlockshttps://wordpress.org/support/topic/conflict-with-generateblocks/
-
.htaccess: Invalid command ‘SGS’https://wordpress.org/support/topic/htaccess-invalid-command-sgs/
-
Plugin doesn’t workhttps://wordpress.org/support/topic/plugin-doesnt-work-340/
-
Protect System Folders causing LiteSpeed browser errorhttps://wordpress.org/support/topic/protect-system-folders-causing-litespeed-browser-error/