If you’ve ever clicked a link on your WordPress site and landed on a blank “Page Not Found” screen, you already know how frustrating a 404 error can be — both for you and your visitors. But here’s the good news: in most cases, fixing a 404 error in WordPress is simpler than it looks, and you don’t need to be a developer to do it.
In this guide, we’re going to walk through exactly what causes 404 errors in WordPress, and more importantly, how to fix them — including a reliable fix using your .htaccess file.
What Is a 404 Error?
A 404 error means the server couldn’t find the page being requested. The URL exists in the browser, but WordPress has no idea what content to serve at that address.
This can happen for a number of reasons:
- Your permalinks got corrupted or reset
- Your
.htaccessfile is missing, empty, or has incorrect rules - A plugin conflict broke your routing
- You migrated your site and old URLs no longer work
- Someone manually deleted a page without setting up a redirect
The error itself is harmless to your server — but it’s bad for user experience and SEO. Search engines don’t like crawling dead links, and visitors who hit a 404 rarely stick around.
Why WordPress Sites Get 404 Errors
WordPress uses a system called pretty permalinks — human-readable URLs like /blog/my-post/ instead of /?p=123. For these to work, WordPress needs to rewrite URLs behind the scenes using Apache’s mod_rewrite module.
This rewriting is handled by a file called .htaccess, which sits in the root directory of your WordPress installation. If this file is missing, corrupted, or has wrong rules, WordPress can’t route requests correctly — and visitors get a 404 error instead of your content.
This is why most WordPress 404 issues come back to one thing: a broken or missing .htaccess file.
Method 1: Resave Your Permalinks (Try This First)
Before touching any files, try the simplest fix first. WordPress can regenerate your .htaccess rules automatically.
- Log in to your WordPress Admin Dashboard
- Go to Settings → Permalinks
- Don’t change anything — just click Save Changes at the bottom
That’s it. WordPress will rewrite the .htaccess file with the correct rules. In many cases, this single step resolves the 404 problem immediately.
If the 404 error persists after doing this, move on to the next method.
Method 2: Fix the .htaccess File Manually
If resaving permalinks didn’t work, your .htaccess file may be corrupted, missing, or have extra code that’s breaking things. The solution is to replace it with WordPress’s default .htaccess code.
Step 1: Access Your Website Files
You’ll need to access your website’s root directory. You can do this via:
- cPanel File Manager (most shared hosting providers)
- FTP client like FileZilla
- SSH (for advanced users)
Navigate to the root folder of your WordPress installation — this is the same folder where you’ll find wp-config.php, wp-admin/, and wp-content/.
Step 2: Find the .htaccess File
Look for a file named .htaccess.
Note: On some systems,
.htaccessis hidden by default because it starts with a dot. In cPanel File Manager, click Settings (top right) and check Show Hidden Files. In FileZilla, go to Server → Force Showing Hidden Files.
Step 3: Back Up the Existing .htaccess File
Before making any changes, always create a backup. Download a copy of the current .htaccess file to your computer, or rename it to .htaccess_backup in your file manager. This gives you a safety net if something goes wrong.
Step 4: Replace With the Default WordPress .htaccess Code
Open the .htaccess file in a text editor and replace all existing content with the following default WordPress code:
apache
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If your WordPress is installed in a subdirectory (e.g.,
yourdomain.com/wordpress/), you’ll need to adjust theRewriteBaseaccordingly. For example, if WordPress is in a folder calledwordpress, changeRewriteBase /toRewriteBase /wordpress/and change the lastRewriteRuletoRewriteRule . /wordpress/index.php [L].
Step 5: Save and Upload the File
Save the file and upload it back to your server (if using FTP). If you’re using cPanel File Manager, just click Save Changes.
Step 6: Test Your Website
Open your browser and visit a few pages on your WordPress site — your homepage, a blog post, and a category page. The 404 errors should be gone.
Method 3: Check File Permissions
Sometimes the .htaccess file exists and has the correct code, but wrong file permissions are preventing Apache from reading it.
The recommended permission for .htaccess is 644. To set this:
- In cPanel File Manager: right-click the file → Change Permissions → set to
644 - Via SSH: run
chmod 644 .htaccess
Method 4: Check if mod_rewrite Is Enabled
WordPress’s permalink system depends on Apache’s mod_rewrite module being active. If it’s disabled on your server, no .htaccess fix will work.
Contact your hosting provider and ask them to confirm that mod_rewrite is enabled on your server. On most shared hosts, it’s enabled by default, but on some VPS setups it may need to be turned on manually.
Method 5: Check for Plugin Conflicts
If your .htaccess is correct and mod_rewrite is enabled but you’re still getting 404 errors, a plugin may be interfering with your URL routing.
To test this:
- Go to Plugins → Installed Plugins in your WordPress dashboard
- Click Deactivate All (or deactivate them one by one to find the culprit)
- Check if the 404 errors disappear
If they do, reactivate plugins one by one until the 404 returns — that’s your problematic plugin. Check for an update or contact the plugin developer.
Method 6: Fix 404 Errors for Specific Posts or Pages
If only certain posts or pages are returning 404 errors (not your entire site), the issue may be:
- The post/page was deleted — you need to recreate it or set up a 301 redirect from the old URL to a new one
- A slug conflict — two posts with the same URL slug
- A post status issue — the post is set to “Draft” instead of “Published”
For setting up redirects, you can use a plugin like Redirection (free) to point old broken URLs to new working pages.
How to Monitor 404 Errors Going Forward
Once you’ve fixed your 404 errors, it’s smart to keep an eye on them so you can catch new ones quickly. A few tools that help:
- Google Search Console — go to Coverage → Excluded → Not Found (404) to see a list of URLs Google flagged
- Redirection plugin — logs 404s automatically
- Screaming Frog SEO Spider — crawls your site and flags broken links
Quick Summary
| Problem | Fix |
|---|---|
| All pages return 404 | Resave permalinks or fix .htaccess |
| .htaccess missing or corrupted | Replace with default WordPress .htaccess code |
| Wrong file permissions | Set .htaccess to 644 |
| mod_rewrite not active | Contact host to enable it |
| Plugin conflict | Deactivate plugins to isolate the issue |
| Only certain pages 404 | Set up 301 redirects or restore the content |
Final Thoughts
A 404 error on a WordPress site almost always has a fixable cause. The most common culprit — a broken .htaccess file — can be resolved in minutes by replacing it with WordPress’s default code. Start with the permalink resave trick, and if that doesn’t work, go ahead and update the .htaccess file manually using the code provided in this guide.
Once you’ve fixed the errors, take a few minutes to monitor your site through Google Search Console so you can stay on top of any 404s that crop up in the future. Your visitors (and your SEO rankings) will thank you.
Have questions or ran into a different type of 404 error on your WordPress site? Drop a comment below — we’re happy to help troubleshoot.
