If your WordPress homepage loads fine but every post or page gives a 404 error, the problem is almost always outdated permalink rewrite rules, not a missing file. It usually happens right after you move your site to a new host, restore a backup, change your domain, or switch themes, and it is normally fixed in a few minutes without editing any code.
Why This Happens
WordPress uses "pretty" URLs, like yoursite.co.ke/about-us, instead of the default yoursite.co.ke/?p=123. These friendly URLs depend on rewrite rules stored in a file called .htaccess in your site's root folder. Common triggers include:
- Moving your site to a new host or server
- Restoring a website or database backup
- Changing your domain or nameservers
- Switching themes or updating WordPress core
When any of these happen, the rewrite rules can fail to carry over, so your server no longer knows how to route a pretty URL back to the correct WordPress post or page.
Step 1: Resave Your Permalink Settings
This resolves the majority of cases and takes under a minute.
- Log in to your WordPress Admin dashboard.
- Go to Settings, then Permalinks.
- Without changing any option, click Save Changes at the bottom of the page.
Saving the Permalinks page, even with no changes selected, forces WordPress to regenerate its rewrite rules. Open a post or page that was showing a 404 error and refresh to check.
Step 2: Check Your .htaccess File
If Step 1 did not fix it, WordPress may not have been able to write to your .htaccess file, or the file may be missing entirely. You will need to check this from your hosting control panel's file manager.
In cPanel
- Open File Manager from your cPanel dashboard.
- Navigate to the folder where WordPress is installed, usually public_html.
- Click Settings in the top-right corner of File Manager and turn on Show Hidden Files (dotfiles), then click Save.
- Look for a file named .htaccess. If you cannot find one, create a new blank file with that exact name in the same folder, then repeat Step 1 so WordPress can write its rules into it.
In DirectAdmin
- Open File Manager from your DirectAdmin dashboard.
- Navigate to the public_html folder, or the correct document root if your domain is set up differently.
- Enable the option to show hidden files if it is not already visible, then look for .htaccess.
- If it is missing, create a new blank file named .htaccess in the same folder, save it, then repeat Step 1 so WordPress can write its rules into it.
Step 3: Rule Out Caching
If you use a caching plugin, clear its cache after completing Steps 1 and 2. Cached versions of a page can keep showing a 404 error even after the underlying issue is fixed, so a fresh page load is worth checking before assuming the fix did not work.
Step 4: Still Not Working?
If posts and pages are still returning a 404 error after resaving permalinks, confirming your .htaccess file, and clearing your cache, contact ZIPROF support so we can check your server's rewrite module and file permissions directly.
If this happened right after moving your site to ZIPROF, see how to move a WordPress site to a new host without breaking it for a full pre- and post-move checklist.