Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pb-seo-friendly-images domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the johannes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121
How to disable Mod_Sec for a specific folder/file - PC✗3
How to disable Mod_Sec for a specific folder/file

How to disable Mod_Sec for a specific folder/file

On a WordPress website that is protected with ModSecurity, when admin edits pages using Elementor or Gutenber in wp-admin dashboard, ModSecurity may falsely detect it as XSS attack.

What we usually do is disable specific rules that create this false positive, but in this case, it is because HTML/JS code is submitted. So it is better just to disable ModSecurity for the specific URL that causes this error.

To do this, add following code to Apache VirtualHost entry for this web site.

<If "%{REQUEST_URI} =~ m#//wp-admin/admin-ajax.php#">
    SecRuleEngine Off
</If>

<If "%{REQUEST_URI} =~ m#/wp-admin/ajax.php#">
    SecRuleEngine Off
</If>

This will disable ModSecurity for URLs /wp-admin/admin-ajax.php and /wp-admin/ajax.php

If instead you want to disable Mod_Sec completely for a specific domain in cPanel, you can learn how to do exactly that here.

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.