How to Fix 404 Errors on WordPress Websites
When pages on your WordPress site show a 404 error or cannot be found. This article explains how to troubleshoot URL issues, reset permalinks, update .htaccess, and check SSL or Cloudflare settings.
This error occurs for the following reasons.
1. SSL isn't installed but the URL set is for https://
2. The URL is set but is incorrect.
3. CloudFlare SSL isn't set to Full Strict or the CDN is causing an issue.
To fix these you need to first find the Database name. This can be found in the wp-config.php file in the WordPress installation folder.
The constants are DB_USER, DB_NAME, DB_PASSWORD
How to change the Wordpress site URL?
https://wordpress.org/support/article/changing-the-site-url/
1. To fix the SSL issue you need to install SSL. If SSL installation fails you can try renaming the .htaccess file inside the WordPress installation.
2. To fix the Cloudflare SSL, you need to ask the client to contact Cloudflare.
Check .htaccess
This is the default .htaccess for Wordpress
---
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
---
If this doesn't fix the issue, keep the .htaccess and go do this.
Wordpress admin => Settings => Permalinks => Save