Title: 500 error when optimizing firewall
Last modified: April 5, 2022

---

# 500 error when optimizing firewall

 *  Resolved [Matheus](https://wordpress.org/support/users/mpassosbr8/)
 * (@mpassosbr8)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/500-error-when-optimizing-firewall/)
 * Hey guys,
 * When I try to optimize the Wordfence firewall, my site throws 500 errors. When
   I remove what Wordfence adds to the .htaccess file, my site doesn’t throw errors
   anymore.
 * How might I resolve this?
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2F500-error-when-optimizing-firewall%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [Matheus](https://wordpress.org/support/users/mpassosbr8/)
 * (@mpassosbr8)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/500-error-when-optimizing-firewall/#post-15529035)
 * And in advance, this is what WordFence adds to the .htacess file:
 *     ```
       # Wordfence WAF
       <IfModule mod_php5.c>
       	php_value auto_prepend_file '/srv/www/wordpress/wordfence-waf.php'
       </IfModule>
       <IfModule mod_php7.c>
       	php_value auto_prepend_file '/srv/www/wordpress/wordfence-waf.php'
       </IfModule>
       <IfModule mod_php.c>
       	php_value auto_prepend_file '/srv/www/wordpress/wordfence-waf.php'
       </IfModule>
       <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
       ```
   
 *  Plugin Support [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * (@wfpeter)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/500-error-when-optimizing-firewall/#post-15532736)
 * Hi [@mpassosbr8](https://wordpress.org/support/users/mpassosbr8/), thanks for
   getting in touch with us.
 * Do you still experience the same problem if you remove each `<IfModule...` section
   individually? On some hosts, the operations on “.user.ini” can be a cause of 
   issues but I have only seen this rarely.
 * If nothing except for removing the whole block inserted by Wordfence seems to
   help, could you please send me a diagnostic report when this is the case so that
   you are able to access the Wordfence administration screens? You can send it 
   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](https://www.wordfence.com/wp-content/uploads/2021/09/diagnosticsendbyemail.png)
 * Thanks,
 * Peter.

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

The topic ‘500 error when optimizing firewall’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/500-error-when-optimizing-firewall/#post-15532736)
 * Status: resolved