Fixing WordPress Permalink and 404 Issues
Fixing WordPress Permalink and 404 Issues
If your WordPress pages are returning 404 errors when they should exist, or links within your site are broken after a migration or plugin change, the most common fix is to flush (regenerate) your WordPress rewrite rules.
The Quick Fix: Flush Permalinks
- Log in to your WordPress admin at
yourdomain.com/wp-admin - Go to Settings > Permalinks
- Without changing anything, click Save Changes
This regenerates the .htaccess file and flushes the rewrite rules. In most cases, 404 errors will be resolved immediately after doing this.
If You Cannot Access WordPress Admin
If the 404 issue is preventing you from logging in or accessing admin:
- Connect to your site via SFTP. See SFTP Access
- Navigate to the root of your WordPress installation
- Open the
.htaccessfile - Replace the contents between the WordPress comment markers with the default WordPress rules:
# 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
- Save the file
- Log in to WordPress admin and re-save Permalinks as above
Only modify the .htaccess rules between the # BEGIN WordPress and # END WordPress markers. Anything outside these markers is added by other plugins or server configurations and should not be removed.
Permalink Settings After Migration
If you have recently migrated your site to Kapsule, your old .htaccess file may contain rules from a different server environment. After migration:
- Go to Settings > Permalinks
- Select your preferred URL structure (for example, Post name)
- Click Save Changes
If you are using a custom permalink structure, note it down before flushing. The flush does not change your chosen permalink format, it just regenerates the rules that make it work.
If the Issue Persists
Check the following:
- Confirm
mod_rewriteis enabled on the server (Kapsule enables this by default) - Ensure the
.htaccessfile in your site root is writable by the web server - Deactivate recently installed plugins one at a time to check for conflicts
If none of these resolve the issue, open a support ticket in KPanel under Support.
