How to Fix WordPress 404 Errors After Changing Permalinks (7 Fixes)
Have you ever changed your WordPress permalink settings, moved your website to a new server, or installed a plugin, only to discover that your posts and pages suddenly return a 404 Page Not Found error?
It can be frustrating, especially when your homepage is working perfectly and all your content is still visible inside the WordPress dashboard.
In many cases, the problem isn’t that your pages have disappeared. WordPress may simply be unable to route the requested URL to the correct content because its rewrite rules are outdated or the web server isn’t handling the URLs correctly.
Fortunately, this problem can often be fixed without deleting content, reinstalling WordPress, or changing your entire permalink structure.
In this guide, we’ll walk through seven practical ways to fix WordPress permalink 404 errors, starting with the safest and simplest solutions.
Why Do WordPress Permalinks Return 404 Errors?
WordPress uses rewrite rules to translate human-readable URLs into requests that can retrieve the correct page, post, or other content.
For example, when someone visits:
https://example.com/about/
WordPress and the web server need to correctly process that URL and find the content associated with it.
If the rewrite rules are outdated, missing, or not being applied by the server, WordPress may return a 404 error even though the page exists.
Common causes include:
- Changing the permalink structure.
- Moving WordPress to another hosting provider or server.
- Incorrect or missing .htaccess rewrite rules.
- Nginx configuration problems.
- Activating a plugin that registers custom post types.
- Two pages or content types using conflicting URL paths.
- Changing a page or post slug without redirecting the old URL.
- Incorrect website document root after a migration.
1. Resave Your Permalink Settings
This should be your first troubleshooting step when multiple WordPress pages or posts suddenly return 404 errors.
Resaving the permalink settings refreshes WordPress’s rewrite rules without requiring you to change your existing URL structure.
How to refresh WordPress permalinks

- Log in to your WordPress dashboard.
- Go to Settings > Permalinks.
- Review your current permalink structure.
- Do not change the selected structure.
- Scroll to the bottom of the page.
- Click Save Changes.
Now open one of the URLs that was returning a 404 error and test it again.
In many cases, this simple step resolves the issue immediately.
Important: You do not need to switch from Post name to another structure and then switch it back just to refresh rewrite rules. Start by saving your existing settings without changing them.
2. Check Your .htaccess File
If resaving the permalink settings doesn’t fix the problem, the next step is to check your .htaccess file.
WordPress commonly uses .htaccess to manage rewrite rules on Apache servers and many LiteSpeed hosting environments.
A missing, corrupted, or incorrectly configured .htaccess file can prevent WordPress from handling pretty permalinks correctly.
Locate the .htaccess file
- Open your hosting control panel, such as cPanel.
- Go to File Manager.
- Open the directory where WordPress is installed.
- Locate the .htaccess file in the website’s document root.
- If you cannot see it, enable the option to show hidden files or dotfiles.
The WordPress installation directory usually contains files such as:
- wp-config.php
- wp-admin
- wp-content
- wp-includes
- index.php
- .htaccess
Back up the existing .htaccess file
Before editing anything, download a copy of the current .htaccess file or create a backup with a different filename.
This is important because the file may contain additional rules for redirects, security, caching, SSL, or other applications.
Never replace the entire file without reviewing the existing configuration.
Check the standard WordPress rewrite rules
For a typical single-site WordPress installation located in the domain’s root directory, the standard rewrite block looks similar to this:
# BEGIN WordPress
<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
This block tells Apache to send requests that do not correspond to existing files or directories to WordPress’s index.php file.
Important: These are standard root-install rules. If WordPress is installed in a subdirectory, your website uses Multisite, or your server has custom rewrite rules, the correct configuration may be different.
If WordPress displays a message on the Permalinks screen telling you that the rewrite rules need to be updated manually, use the rules shown by WordPress for your installation rather than blindly copying a generic block.
3. Check Whether Apache Rewrite Rules Are Enabled
On Apache servers, WordPress pretty permalinks depend on URL rewriting being available and configured correctly.
If the .htaccess file contains the correct rules but your website still returns 404 errors, your server may not be applying them.
Possible causes include:
- Apache’s mod_rewrite module is not enabled.
- The server configuration does not allow .htaccess overrides.
- The website is using an incorrect document root.
- The .htaccess file has incorrect ownership or permissions.
- The hosting provider has a custom server configuration.
If you are using shared hosting, contact your hosting provider and ask them to verify:
- Whether mod_rewrite is enabled.
- Whether AllowOverride permits the required .htaccess rules.
- Whether the correct document root is being used.
- Whether the .htaccess file is being read by the web server.
A correct WordPress rewrite block cannot fix a server configuration that ignores the file entirely.
4. Check Nginx Configuration
If your website runs on Nginx, remember that Nginx does not use .htaccess files.
Unlike Apache, Nginx handles rewrite rules through its server configuration. WordPress cannot automatically modify those server settings.
A typical WordPress Nginx configuration includes a rule similar to this:
location / {
try_files $uri $uri/ /index.php?$args;
}
This tells Nginx to check whether the requested URL corresponds to an existing file or directory. If it does not, the request is passed to WordPress through index.php.
If your website uses Nginx and pretty permalinks are returning 404 errors, ask your hosting provider or server administrator to check the WordPress rewrite configuration.
Do not paste Nginx configuration into .htaccess. They are different configuration systems, and Nginx does not read .htaccess files.
If you manage your own VPS, back up the server configuration, validate it with the appropriate configuration test, and reload the service only after the test succeeds.
5. Check for Conflicting Page or Custom Post Type Slugs
Sometimes only one specific URL returns a 404 error while the rest of the website works normally.
In this situation, the problem may not be related to the server’s rewrite rules.
WordPress pages, posts, categories, and custom post types can sometimes use conflicting URL paths.
For example, imagine you have:
- A WordPress page with the slug
events. - An Events plugin that also registers its archive at
/events/.
Both content types are trying to use the same URL. This can create routing conflicts or cause one section of the website to display unexpected content.
How to check for slug conflicts
- Open the affected page or post in WordPress.
- Confirm that it is published and not in the Trash.
- Review its permalink and slug.
- Check whether another page, category, or custom post type uses the same path.
- Review the settings of the plugin that registers the custom post type.
- Change the conflicting slug or archive path if necessary.
- Resave the permalink settings after the relevant rewrite configuration has changed.
For example, you could change the page slug from events to upcoming-events if the Events plugin needs to own the /events/ archive path.
Always test the resulting URL before making additional changes.
6. Fix Broken URLs After Changing a Page or Post Slug
If only one page or post returns a 404 error, check whether its URL was recently changed.
For example, a page may previously have used:
https://example.com/services/wordpress-development/
But after editing its slug, the new URL becomes:
https://example.com/wordpress-development/
The new URL may work correctly while the old address still returns a 404 error.
This is different from a site-wide permalink problem. The page may be working normally at its new address.
Set up a 301 redirect
If the old URL has backlinks, appears in Google search results, or has been shared with customers, redirect it to the correct new address.
A 301 redirect tells browsers and search engines that the content has permanently moved to another URL.
You can configure redirects using:
- A reliable WordPress redirect plugin.
- Your hosting control panel’s redirect feature.
- Server-level redirect rules, when appropriate.
Make sure the redirect points to the most relevant replacement page.
Do not automatically redirect every broken URL to your homepage. If a page has genuinely been removed and has no relevant replacement, a proper 404 or 410 response may be more appropriate.
7. Clear Your Cache and Check After Migration
If the permalink settings and server rules appear correct, clear any caching layers that may be serving an outdated response.
Check the following:
- Your browser cache.
- Your WordPress caching plugin.
- Your hosting or server cache.
- Your CDN cache, if you use one.
Then test the affected URL in a private or incognito browser window.
After moving WordPress to a new host
If the problem started after a migration, also confirm that:
- The domain points to the correct server.
- The domain’s document root points to the correct WordPress directory.
- The website’s WordPress Address and Site Address settings are correct.
- The correct rewrite configuration exists on the new server.
- The migration did not leave the website using an old directory or configuration file.
A migration from Apache to Nginx, for example, may require server-level rewrite configuration that was previously handled by .htaccess.
Simply copying the old .htaccess file to the new server will not solve an Nginx rewrite problem.
Quick Troubleshooting Checklist
Use this checklist to identify which solution is most likely to help:
- Homepage works, but all posts and pages return 404: Resave permalinks and check server rewrite rules.
- 404 errors started after changing permalink settings: Save the existing permalink settings again and check .htaccess or Nginx configuration.
- Only one page returns 404: Check the page slug, publishing status, Trash, parent path, and redirects.
- Custom post type pages return 404: Check the plugin or code registering the post type, rewrite settings, and slug conflicts.
- 404 errors started after migration: Check document root, server configuration, domain settings, and caching.
- WordPress cannot update .htaccess: Review the file ownership and permissions with your host, or use the rewrite rules WordPress displays for manual updating.
- Website runs on Nginx: Ask the server administrator to verify the WordPress try_files configuration.
Final Thoughts
WordPress permalink 404 errors can look serious, but in many cases the content is still there. The problem is simply that the requested URL is not being routed to the correct page.
Start by resaving your permalink settings. If that doesn’t work, check the .htaccess file, server rewrite configuration, conflicting slugs, redirects, and caching.
Make one change at a time and test the exact URL after each step. This makes troubleshooting easier and helps prevent additional problems.
If you are managing a live website, always back up server configuration files before editing them. When server-level rewrite rules are involved, your hosting provider can often identify the problem much faster than making random changes.