Troubleshooting 404 Page Not Found Error After Saving WordPress Menus
Today, I ran into a problem I didnât expect. I was trying to save a menu on WordPress and got a â404 Page Not Foundâ error. Itâs a weird issue, isnât it? If youâre dealing with this too, letâs figure out together how to fix it.
Problem:
Youâre seeing a 404 error when you try to save a WordPress menu. The problem goes away if you turn off ModSecurity.
Why This Happens:
ModSecurity uses a set of rules to protect your website. Sometimes, these rules mistakenly block harmless actions (like saving your menu), which is whatâs happening here.
ModSecurity is an open-source web application firewall (WAF) that protects websites from various types of attacks. It inspects incoming server traffic and applies rules designed to block common threats like SQL injections and cross-site scripting. Compatible with multiple web servers like Apache, Nginx, and IIS, it enhances security through real-time traffic monitoring and analysis.
How to Fix It:
Turning off ModSecurity can fix this, but itâs not recommended because it leaves your website unprotected. Here are safer solutions:
- Update your rules: If your ModSecurity rules are old, updating them might fix the issue.
- Switch ModSecurity to âDetection Onlyâ mode: This lets you see what ModSecurity would block without actually blocking it, so you can figure out whatâs causing the problem.
- Allow certain actions: You can create a rule that allows saving a WordPress menu.
- Turn off the problem rule: If one rule is causing the problem, you can turn it off. Just be careful not to leave your site unprotected.
With these steps, you can solve the issue and keep your website safe and working smoothly.