A WordPress 404 on your links, while the homepage opens normally, is almost always fixed by saving your permalinks again from Settings > Permalinks, so that the .htaccess rules are rewritten. If the homepage opens the wrong page, check what is set as the homepage in Settings > Reading. Both are WordPress settings, not hosting settings.
The WordPress homepage opens a different page
Start with the setting that controls what the WordPress homepage displays.
- Log in to the WordPress dashboard.
- Open Settings > Reading.
- Under Your homepage displays, see which option is active.
- If you want a static homepage, select A static page (select below).
- Under Homepage, choose the page you want to open first.
- Under Posts page, choose a different page for your posts, or leave it empty if you have no blog.
- Click Save Changes.
The Your latest posts option shows your most recent posts on the homepage. If your site is a company site or an eshop and you suddenly see a list of posts, the setting has usually switched back to this option. The homepage and the posts page must be different pages.
The setting is correct but the homepage doesn't change
If Settings > Reading shows the correct page and the homepage is still wrong, check in this order:
- Cache. You are seeing a stored version of the page. Clear the cache of LiteSpeed Cache, of your browser and of Cloudflare if you use it. Details in the article on clearing the cache.
- The theme's homepage template. Many themes have their own template for the homepage, which overrides the Reading setting. In block themes you change this template from the site editor under Appearance. In classic themes, check the theme's settings or ask its developer.
- An old index.html file. The server opens an
index.htmlfirst and WordPress'sindex.phpafter it. If anindex.htmlfrom an old site or an "under construction" page has been left inpublic_html, that is what shows as the homepage. Open the cPanel File Manager and rename it, for example toindex.html.old. - Plugins. Maintenance or "coming soon" plugins, multilingual plugins with a separate homepage per language, and redirect plugins can change the homepage. Check their settings or deactivate them one at a time from Plugins.
- The site address. Under Settings > General, the WordPress Address (URL) and Site Address (URL) fields must contain the correct address with
https://. Don't change them unless you are sure, because a wrong value locks you out of the dashboard.
The page that opens is not one you created. If you see a page with content you don't recognise, or you are sent to another site, the site may have been compromised. Don't wait, and follow the guide to recovering WordPress after a hack.
Links return 404 not found while the homepage opens
When the homepage works but every other page, post or product returns 404 not found, WordPress is not "translating" the page addresses. Every address passes through a rule in the .htaccess file to WordPress, and WordPress keeps the list of address formats in its database. Konet's LiteSpeed Web Server reads .htaccess without any extra configuration.
Common causes:
- There was a migration, a restore or a new installation and
.htaccesswas not copied. - A plugin, or someone manually, changed
.htaccessand deleted the WordPress rules. - A new plugin with its own content types, such as products or events, was activated and the rules were not refreshed.
How do I flush permalinks in WordPress
Saving the permalinks again (flush permalinks) rewrites both, without changing any address on the site.
- Open Settings > Permalinks.
- Don't change anything and click Save Changes at the bottom.
- Check that the message Permalink structure updated. appears.
- Open a page that returned 404 again, in a private browsing window.
If the 404 remains:
- On the same screen, temporarily select another structure, for example Plain.
- Click Save Changes.
- Switch back to the structure you had, usually Post name or Custom Structure with exactly the same value.
- Click Save Changes again.
Keep the structure the site already had. If you change it permanently, all addresses change and the links Google already has are lost.
If you have WooCommerce, the same screen also has the permalink settings for products. Leave them as they were and save.
Check the WordPress .htaccess
If after saving WordPress shows you rules to copy, it could not write the file itself. In that case, or if you simply want to check the WordPress htaccess:
- Open cPanel > Files > File Manager.
- Click Settings, tick Show Hidden Files (dotfiles) and click Save.
- Go to the WordPress folder, usually
public_html. - Download a copy of
.htaccessto your computer before changing it. - Open
.htaccesswith Edit and find the block that starts with# BEGIN WordPress. - If it is missing, add it at the end of the file and click Save Changes.
For WordPress installed in public_html, the default block is:
<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>
If WordPress is in a subfolder, the paths change. In that case prefer saving the permalinks so that WordPress writes the correct ones, and see the article on a site in a subfolder. Don't delete other lines in .htaccess, for example LiteSpeed Cache rules or PHP version rules. If something goes wrong, upload the copy you kept.
Only one page returns 404
If the whole site works and only one page returns 404:
- In Pages > All Pages, check that the page is published and not a Draft or in the trash.
- With Quick Edit, check the Slug. If it changed, the page address changed too.
- If the old address is in ads, newsletters or on Google, add a 301 redirect to the new one, with a redirect plugin or from cPanel Redirects.
Frequently Asked Questions
Why does the WordPress homepage show posts instead of my homepage?
Your latest posts is selected in Settings > Reading. Select A static page (select below), choose the Homepage and save.
After migrating the site all links return 404, what happened?
Usually .htaccess was not migrated. Save the permalinks again and, if needed, add the WordPress block as shown above.
I changed the WordPress permalinks and lost my Google rankings, what do I do?
Switch back to the previous structure, if you remember it, and save. If you definitely want the new structure, you need 301 redirects from the old addresses to the new ones.
The eshop products return 404 but the pages open, why?
Usually the product rules were not refreshed after an update or a plugin activation. Save the permalinks again without changing the product settings.
I made the changes but I still see the same thing, why?
Most likely you are seeing a cached version. Clear the LiteSpeed Cache and browser cache and open the site in a private browsing window.
I broke .htaccess and now nothing opens, how do I restore it?
Upload the copy you kept. If you don't have one, restore the file from JetBackup 5 with a date before the change, as we describe in the JetBackup 5 guide.