WP on Ubuntu 22.04 w/ Apache Server – .htaccess WAF entry breaks site
-
Note: Ubuntu, Apache2, php, mysql, WP and WF are on the latest release versions. Hi, I’m setting up a new self-hosted website on an Ubuntu 22.04 server running Apache2 with a new fresh install of WordPress. My config makes use of the .htaccess file. I’ve had WordFence installed for a few days in learning mode. Tonight, I changed the Firewall to extended protection after making options/settings adjustments in the plugin. The WF plugin adds the following to my .htaccess file within the site’s WordPress directory;
# Wordfence WAF <IfModule mod_php5.c> php_value auto_prepend_file '/var/www/mydomain.com/wordpress/wordfence-waf.php' </IfModule> <IfModule mod_php7.c> php_value auto_prepend_file '/var/www/mydomain.com/wordpress/wordfence-waf.php' </IfModule> <IfModule mod_php.c> php_value auto_prepend_file '/var/www/mydomain.com/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
You have likely noticed that I’ve commented out the <Files “.user.ini”> section, because it breaks my site with a 500 error stating a misconfiguration problem. The WF Firewall dashboard still shows that my protection level is Extended even without the <Files “.user.ini”> .htaccess entry active. I don’t have a .user.ini file in my site’s directory (the location of my .htaccess file). I’m using php v8.1. My php.ini shows that the “auto_prepend_file | /var/www/mydomain.com/wordpress/wordfence-waf.php | no value” setting is accurate. I’ve confirmed that my php.ini is the active and correct file being used by WordPress.
Please help me understand why the plugin is adding the <Files “.user.ini”> section to my .htaccess file, and also, why that section breaks my site completely. Lastly, I have confirmed that my Apache2 passes the configtest. With the <Files “.user.ini”> commented out, my site runs as expected. I’m all out of troubleshooting options. ?? I appreciate any advice or clarification you can offer.
- The topic ‘WP on Ubuntu 22.04 w/ Apache Server – .htaccess WAF entry breaks site’ is closed to new replies.