Recently one of our client contact us for a Post and Page gives 404 error. Client explained his problem as ” When I try to update the page or post in WordPress, I get 404 error and website directs to front-end”. Well we are aware about some common reason for such errors but even after fixing it, error was still there. So before going to the our solution for our client. Please check below few fix which can help you to fix your 404 error on WordPress.
Table of Contents
Two Common fix for Saving Page gives 404 error :
1. Fix 1 : Flush the old Permalinks
- Login into WordPress dashboard as Admin.
- Click on settings on left menu and select Permalinks.
- On Permalinks page, scroll down and click on save (don’t make any changes). This is flush the old link structure and create a new one.
2. Fix 2 : Editing .htaccess file
- Login into your Cpanel or access your server as FTP.
- On root folder (via file manager), right click on .htaccess and select edit. A new tab will open.
- Delete old code in file and paste the below code.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
NOTE : if .htaccess is not visible then you have to show hidden files in settings of cpanel.
Our Fix for Page gives 404 error :
Fix using White listing mod_security rule
Even after trying above two options, if Saving Page gives 404 error was still there. Above solutions are mostly on all blog and websites. We researched for some time to figure out Mod Security and decided to contact the hosting service of the website because website is blocking the access sometimes.
Client has NAMECHEAP Hosting services. We contacted NAMECHEAP support and informed the whole scenario. NAMECHEAP support is really quick and they fixed the problem in 5 minutes. So below is the problem which Returning 404 Error after saving WordPress Posts/Page.
The issue may be caused by Mod-security. Mod-security is an Apache module which works as a web application firewall. It blocks known exploits and provides protection from a range of attacks against web applications. However, sometimes, mod_security may incorrectly determine that a certain request is malicious, while it is actually legitimate. In such a situation, You can contact Hosting provider and they can whitelist the triggered mod_security rule on the server, so that you can bypass the block. It will fix the 404 error after saving WordPress Posts/Page.
So that’s how we fix the issue. So next time you got 404 error after saving WordPress Page/Post , try 3rd fix after trying the above two.
let us know if you have any questions in comment section or you can also contact our Support team.
Happy Coding 🙂