what is a 404 error?
A 404 error is a type of HTTP response code, and this particular one tells your browser: ‘This webpage cannot be found‘. This is bad for SEO rankings on Google, and must be fixed ASAP. To find out if your website has any 404 errors, sign up or login to Google Search Console.
Here is how a 404 error works:
During a visit to any website, your browser sends out a ‘request‘, basically asking “Are you alive?”. The website, which is linked to an IP Address, points to a server, and that server responds with an HTTP Response.
The normal response is the status code ‘200 – page ok‘, which we don’t actually see – but we know everything is fine, because the web page loads normally. Every website you have visited that is working, has given off a 200 code, page OK.
What happens when the http response is not 200?
If the status code does not equal 200, then something is wrong with the website / server. Instead of displaying the website, the browser is told to display a white page with text that includes the specific error code. This makes it easier for developers to locate what is wrong with the website.
What does a 404 error mean?
A 404 error is a code meaning ‘page not found’. What this actually means, is something happened to your index file, maybe it was deleted or corrupted. In some cases, you may see the homepage working, but every other page has a 404 error. This means the WordPress permalinks are wrong.
Let’s learn how to fix it!
how to fix a 404 error?
There are 2 common fixes for this error.
1) If the 404 error shows on every page except for the homepage (meaning homepage works), and this is fixed by resetting the permalinks.
2) Or if the 404 error is on the homepage, go to your file manager, and look for a file called ‘index.php’.
404 on Homepage
The index file should be in your websites ‘root folder’. Root folder is where all files are, there will be a large list of files beginning with wp- and 3 folders; wp-admin, wp-includes, wp-content. If you see these, you are in the right place.
Fix based on the following 2 scenarios:
1) You are missing index.php, Download another copy from the WordPress Github page, or copy this code and create your own new file called index.php (in the same folder you are already in), and paste the code inside it.
2) Index.php is NOT missing. look for a file called .htaccess. It begins with a period, which means its normally a hidden file. If you can’t see it, go to your settings in File Manager, and click ‘Show Hidden Files’. Once you find the .htaccess file, simply rename it.
Now refresh your webpage, and you should see your website!
Note-(I find it important to keep the original file names – so I add a (.)broken after the name, and rename it to .htaccess.broken.)
404 on Every Page Except Homepage
If you can see your homepage, but every other page has a 404 error, this is a super simple fix.
All you need to do is:
- login to the WordPress Dashboard.
- Find ‘Settings’ in the left column, and click it to see a dropdown.
- Inside the Settings drop down, click on ‘Permalinks’.
- Take note of your current Permalink Settings, then click off current setting, and back onto current setting, and click ‘Save Settings’.
To find which permalink is the best settings for SEO, we made an article ‘Beginners Guide to SEO‘, check it out – it can make a big difference!