Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #283142

    This may not exactly be a theme problem. It appears to be a conflict/error between iThemes Security plugin and the search box. Clicking on an empty search produces a 403 forbidden error. SEO site crawls show the 403 error with the url with /?s= at the end

    I believe it has something to do with iThemes Security (Formerly Better WP security) plugin

    iThemes places a RewriteCond entry in .htaccess.

    RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|ê|"|;|\?|\*|=$).* [NC,OR]

    Replace it with

    RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|ê|"|;|\?|\*$).* [NC,OR]

    and it fixes the issue. However I’m wondering if there is something that can be done on the theme side because there is some discussion that this could be a theme issue. I have “fixed it” on my site however I can unfix it if you wish to see. You just get a 403 forbidden page when the search is clicked without entering any text.

    Background info is here.

    Any advice/thoughts would be appreciated.


    Hey TheMediaman!

    I don’t think this is related to the theme code but we use a function to redirect the user to the search page if the search query is empty. To deactivate this function comment out this line in wp-content/themes/enfold/includes/helper-template-logic.php:

    add_filter('pre_get_posts', 'avia_search_query_filter');

    or insert:

    function avia_remove_search_redirect(){
    remove_filter('pre_get_posts', 'avia_search_query_filter');

    into the child theme functions.php.




    You are correct that the stock Enfold theme handles the empty search string properly but, it appears, that the iThemes Security plugin adds code to the .htaccess file that causes the problem as I indicated. I know you can’t anticipate problems of what every plugin may cause. I was just wondering if what I posted may identify or lead to a possible solution on your end.

    It’s not a huge problem. I found the fix as I posted and am also trying to see if the plugin developers have anything to say on their end.

    Thanks for your reply. I appreciate it.

    Update: I tried setting the RewriteCond back to original and implementing your suggestion and it did not work. It appears that the fix is with the code added by iThemes Security (formerly Better WP Security). I thought what I posted may tip you off to a possible solution on Enfold side. No worries.

    • This reply was modified 9 years, 11 months ago by TheMediaman.
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Empty search box producing 403 forbidden-possible plugin conflict’ is closed to new replies.