Changing the permalink structure in WordPress can cause pages and posts to return a 404 Not Found error if the server is not correctly processing the rewritten URLs. This article helps a Site Administrator identify and resolve these 404 errors after a permalink change.
Before you begin
You will need:
Administrator access to the WordPress dashboard.
Access to the server's file system or a tool like phpMyAdmin to modify the
.htaccessfile.
Refresh the WordPress Permalinks
Often, a 404 error occurs because the WordPress rewrite rules have not been refreshed. You can usually resolve this by simply saving the settings again.
Log in to the WordPress dashboard.
Navigate to Settings > Permalinks.
Scroll to the bottom of the page and click Save Changes.
Do not change any settings on the page; clicking the button forces WordPress to flush and rewrite the rules in the .htaccess file.
Verify the .htaccess File
If saving the permalink settings does not resolve the issue, the .htaccess file may not have the correct permissions to be updated by WordPress, or it may contain incorrect code.
Access your site's root directory via an FTP client or a File Manager.
Locate the
.htaccessfile in the root directory (usuallypublic_htmlorwww).Open the file and ensure it contains the standard WordPress block:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [C,L] IfModule mod_rewrite.c> RewriteRule ^index\.php [[REQUEST_URI]] [L] RewriteRule ^multi_site_index\.php [[REQUEST_URI]] [L] </IfModule> # END WordPress
Note: If your site is part of a WordPress Multisite network, the code in the block above will differ. Ensure you are using the version provided by your specific installation.
If the file is blank or contains different code, replace it with the standard block shown above.
Save the file and test your links.
Check for Mod_Rewrite Module
If the .htaccess file is correct but 404 errors persist, the Apache mod_rewrite module may not be enabled on your server.
Contact Hostek support to verify if
mod_rewriteis enabled for your account.If it is disabled, provide the specific error (404 on all internal pages) to the support team.
Troubleshooting Plugin Conflicts
Occasionally, a caching plugin or a security plugin can "cache" the old URL structure, leading to 404 errors even after the .htaccess file is corrected.
Deactivate your caching plugin (e.g., WP Rocket, W3 Total Cache).
Clear your browser cache.
Test the links.
If the links work, reactivate the plugin and clear its internal cache.
Limitations
This procedure does not resolve 404 errors caused by incorrect internal links within your content. If a link points to a page that does not exist, it will still return a 404 error regardless of your permalink settings.
