Your posts exist in the dashboard, but when you visit them, you get a 404 Page Not Found error. This is one of the most frustrating experiences for a site owner, especially after a migration or a permalink update. At CODE TOT, we’ve found that 404 errors on “existing” content usually come down to a silent failure in your server’s rewrite engine.

Professional Insight: If you’ve just moved to an Nginx server (typical for high-performance RunCloud setups), the most common cause is a missing try_files directive. Unlike Apache, Nginx does not use .htaccess, so your “Permalink” settings won’t work unless the server config is updated properly.

1. The “Magic” Flush: Re-save Permalinks

90% of WordPress 404 issues are solved by simply going to Settings > Permalinks and clicking “Save Changes” (twice). This sends a command to WordPress to regenerate its internal rewrite rules. If you cannot access the dashboard, you can perform the same action via WP-CLI:

# Flush rewrite rules instantly
wp rewrite flush

2. Apache Users: The .htaccess Checklist

If you’re using Apache, ensure your .htaccess file is not just present, but *writable* by the web server. Check your file permissions (should be 644) and verify that your Apache configuration allows overrides:

# Ensure this is in your Apache config for your site
<Directory /var/www/html>
    AllowOverride All
</Directory>

3. Nginx Users: The try_files Fix

On Nginx, your server configuration block must handle “pretty permalinks.” If this line is missing, every page except the homepage will return a 404:

location / {
    try_files $uri $uri/ /index.php?$args;
}

4. Troubleshooting Custom Post Type (CPT) 404s

If your regular posts work but your “Portfolio” or “Services” (CPTs) return 404, it’s often because the CPT was registered *after* the last permalink flush. After registering a new CPT in your code, you **must** flush your rules. At CODE TOT, we always recommend putting this in your plugin’s activation hook, but never on the init hook directly, as it is a heavy database operation.

Conclusion

404 errors are usually just a “translation” issue between your site and your server. By properly configuring your rewrite rules or flushing your permalinks via WP-CLI, you can get your content back online in seconds. For more advanced SEO-safe migration tips, visit our SEO Resource Center.