Support » Plugin: Wordfence Security - Firewall & Malware Scan » Multisite – Optimizing Firewall – unable to make changes to the .htaccess file

  • Resolved robertdrost

    (@robertdrost)


    Hello,
    First of all, thank you very much for the great plugin that we use on a lot of our websites.
    Now there is a problem on one of these pages (multisite). When I want to optimize the firewall I get the message: “We were unable to make changes to the .htaccess file …”. Also this time the button for downloading the .htaccess is missing, which I usually see in the first step of the optimization.
    I’ve already tried everything that is on the support pages. The .htaccess file authorization is definitely 644. I suspect the problem is that it is a multisite installation. We already had problems installing Wordfence due to cross origin errors. We then set the siteurl to https://myurl.com and left the home url at https://www.myurl.com. Then the installation of Wordfence worked. Could this possibly lead to Wordfence no longer finding the .htaccess file when optimizing the Firewall?

    Thanks a lot!

    Robert

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

    (@wfpeter)

    Hi @robertdrost,

    This can sometimes be due to the software running your webserver, so I think getting a picture of that setup would be the best place to start.

    Can you send a diagnostic report to wftest @ wordfence . com? You can find the link to do so 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: For the fastest response time, please make sure and add any information or questions directly to this topic and not the email address above unless asked.

    Thanks,

    Peter.

    Thread Starter robertdrost

    (@robertdrost)

    Hi @wfpeter

    thanks for your quick response!
    I sent you the report a minute ago.

    Thanks a lot,

    Robert

    Plugin Support wfpeter

    (@wfpeter)

    Hi @robertdrost, thanks for sending that over.

    From the diagnostic, it looks like your Server API is CGI/FastCGI. If you could use FTP or a file manager to access your .htaccess file in the root directory and make sure this code is inserted:

    # Wordfence WAF
    <Files ".user.ini">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
    </Files>
    # END Wordfence WAF

    Then also, in the same directory, edit your .user.ini file with this code:

    ; Wordfence WAF
    auto_prepend_file = '/var/www/vhosts/robstoop.nl/httpdocs/wordfence-waf.php'
    ; END Wordfence WAF

    Make sure you don’t have any files hidden and if the .user.ini doesn’t exist in your root directory, you can create one and add the code above.

    Once you have this code in place, your firewall should be optimized. If you visit your Wordfence > Firewall page, you should see 84% (which is the max a free customer can reach).

    Thanks again,

    Peter.

    Thread Starter robertdrost

    (@robertdrost)

    Hi Peter,

    thank you for looking at the diagnostic report.
    Unfortunately we now get a 500 internal server error. Could it be that the code for the .user.ini is wrong? The path /var/www/vhosts/robstoop.nl/httpdocs/wordfence-waf.php seems not right.
    Somehow I still have the suspicion that Wordfence cannot find .htaccess at all. It is also not suggested for download in the “Optimize Wordfence Firewall” popup.

    Robert

    Thread Starter robertdrost

    (@robertdrost)

    Could it be that the code for the .user.ini is wrong? The path /var/www/vhosts/robstoop.nl/httpdocs/wordfence-waf.php seems not right.

    that actually was the problem. I managed to find out the right path and now it works.

    Thanks a lot for your support @wfpeter

    Robert

    Plugin Support wfpeter

    (@wfpeter)

    Hi @robertdrost,

    That’ll teach me to grab a code snippet too eagerly, I normally insert path/to/your/site/httpdocs... but I had recently overwritten it. Glad you spotted that and inserted the correct path. Really pleased to hear that solution worked for you and have been enjoying Worfence!

    If you need help in the future, by all means start up a new topic and we’ll be glad to help any time!

    Peter.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multisite – Optimizing Firewall – unable to make changes to the .htaccess file’ is closed to new replies.