• Hi,

    I’ve been having a problem with Wordfence for the past few days. On several of my sites, I’m getting 404 errors on all images, and the site starts to run very slowly.

    I discovered that the culprit is the .htaccess file in /wp-content/uploads/, specifically with the directives described in the documentation under “Disable Code Execution for Uploads directory.”

    Is there any solution for this? After I delete the file, it doesn’t come back, and the site works correctly. However, I’m getting this same problem on a different site almost every day, and I have no idea what to do about it.

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support wfpeter

    (@wfpeter)

    Hi @nowayisnotworking, thanks for your message.

    The Disable Code Execution for Uploads Directory option (when saved) runs regardless of any state of the plugin as they are .htaccess rules and get processed before other Wordfence blocks would be. That makes it odd that you’d get inconsistent results across two sites.

    I would see if the affected image file URLs can be loaded directly in a browser. If those work, then another plugin or the theme could be loading images in a way that Wordfence is blocking as a false-positive in the background. For a case such as that, try turning Learning Mode on for a short period and visit pages with images that were failing. If that works, return the firewall to “Enabled and Protecting”.

    If you see the issue again when Learning Mode is turned off, visit the Live Traffic page immediately afterwards. If there is a recent block shown there, check the reason after expanding the entry with the eye icon in the corner. You may find a specific firewall rule or Wordfence setting stated here. The reason is shown in red text.

    Feel free to paste that reason here if you’re unable to manually allowlist it successfully using the “ADD PARAM TO FIREWALL ALLOWLIST” button on the Live Traffic page.

    Let us know how you get on,
    Peter.

    Thread Starter nowayisnotworking

    (@nowayisnotworking)

    Regardless of whether Wordfence is in Learning Mode or normal protection mode, this error is triggered the moment I restore the .htaccess file containing this code:


    # BEGIN WebP Express
    # Plugin is deactivated
    # END WebP Express

    # BEGIN Wordfence code execution protection
    <IfModule mod_php5.c>
    php_flag engine 0
    </IfModule>
    <IfModule mod_php7.c>
    php_flag engine 0
    </IfModule>
    <IfModule mod_php.c>
    php_flag engine 0
    </IfModule>

    AddHandler cgi-script .php .phtml .php3 .pl .py .jsp .asp .htm .shtml .sh .cgi
    Options -ExecCGI
    # END Wordfence code execution protection

    Direct access to images via the browser is also impossible, despite the files actually existing on the server. This issue is global and blocks all images on the site. This occurs on x different sites that don’t share any same plugins.

    I’m sending the Wordfence results for the test you mentioned. I’m not sure if this is fully what you meant, but it shows a “Page Not Found” (404 error). However, the image files are definitely there, and deleting the .htaccess file fixes everything.

    Time: 1 minute ago -- Tue, 02 Dec 25 07:03:28 +0000 -- 1764659008.306146 in Unixtime
    Seconds since last hit: 0.0143
    URL: https://[domain.com]/wp-content/uploads/2025/11/baner-evritell-1200x200px-qemetica-mk-2025.gif
    Type: Page Not Found
    Referrer: https://[domain.com]/?test
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
    Location: [Location Redacted], Poland

    Time: 1 minute ago -- Tue, 02 Dec 25 07:03:28 +0000 -- 1764659008.291876 in Unixtime
    Seconds since last hit: 3.1130
    URL: https://[domain.com]/wp-content/uploads/2022/02/logo-wrp-pl-300x125.jpg
    Type: Normal Request
    Referrer: https://[domain.com]/
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
    Location: [Location Redacted], Poland

    Time: 1 minute ago -- Tue, 02 Dec 25 07:03:25 +0000 -- 1764659005.178860 in Unixtime
    Seconds since last hit: 108.7069
    URL: https://[domain.com]/?test
    Type: Normal Request
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
    Location: [Location Redacted], Poland

    Time: 1 minute ago -- Tue, 02 Dec 25 07:03:28 +0000 -- 1764659008.521115 in Unixtime
    Seconds since last hit: 0.2019
    URL: https://[domain.com]/wp-content/uploads/2024/01/wrp-234x120.png
    Type: Page Not Found
    Referrer: https://[domain.com]/?test
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
    Location: [Location Redacted], Poland
    Plugin Support wfpeter

    (@wfpeter)

    Hi @nowayisnotworking,

    Thanks for the extra information. Ideally, we’d like to run some tests too on your domain. So you don’t need to share that here, you can just send a diagnostic separately to wftest @ wordfence . com by finding the link at the top of the Wordfence > Tools > Diagnostics page. Then click on “Send Report by Email”. Please add your forum username where indicated and respond here after you have sent it.

    NOTE: It should look as follows – Screenshot of Tools > Diagnostic > Send by Email

    Thanks again,
    Peter.

    Thread Starter nowayisnotworking

    (@nowayisnotworking)

    Hi,

    I have sent a report regarding one of the sites. In this specific case, not all images are returning a 404 error, but a significant number of them are. If needed, I can send reports for other sites as well.

    Will you post the response here or send it to my email?

    Thanks for your help.

    Thread Starter nowayisnotworking

    (@nowayisnotworking)

    Hello,

    Do you have some update in this topic?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘404 error on images’ is closed to new replies.