After starting your blog, did you make a small tweak to your website and now your pages are returning the dreaded 404? There are a lot of other bad WordPress errors such as "error establishing database connection or "internal server error”, but we are only going to cover the 404 error in this guide.
The notorious error 404 is caused by two different scenarios. It is usually caused by either a WordPress site being taken down or removed. Or more likely, it is due to an error with WordPress permalinks.
If you find that one of your posts or pages is 404ing here is a quick walkthrough to diagnose the issue.
Does the post or page show up in the Posts or Pages dashboard? If it isn't there, there is a change it was either deleted or moved to the Draft state. Anything that is in the publish state should be accessible through the url that is in the Edit Post/Page screen.
Check the URL. If you manually typed it in, verify it against the Edit Post screen that shows the URL that WordPress put the page. If you add categories or change the hierarchy this can mess with what you thought the URL should be and what WordPress thinks it should be.
The Permalinks configuration (General Settings) is the most likely culprit for 404 errors. If you have recently changed your hosting, migrated your website, or changed the domain name there is probably an inconsistency between the old version of your site and the new one. We'll walk you through updating the permalinks to see if that solves your problem.
This is the most basic way for you to check if your permalinks are causing your 404 errors. All you need to do is access your WordPress dashboard then go to Settings > Permalinks. From here, you can check if the URL structure matches what you expect. Also verify that the domain name is correct. After making the changes, be sure to hit the "Save Changes" button or the changes won't go live.
If you’re a developer or are someone familiar with coding, you can also check the apache configuration. It may not have been set up correctly to begin with and all of your URLs will 404. Here is what the standard apache config looks like.
Since configuring (and misconfiguring) the .htaccess apache file is a common problem, most hosting providers give you access to the file through the cPanel interface. If your hosting provider allows you to access it, you can play around with the changes to see if they help fix your site.
If the cPanel doesn't allow direct access, it may allow you to download and upload the file. Just download it to your computer, make the changes, and re-upload it through the file explorer.
If your hosting provider and plan allows for FTP file access you can also use an FTP client to download the .htaccess file.
Depending on the FTP client you use, it may come with a builtin editor that you can also use to edit the file directly.
Often times, the page is cached in your browser. If you are still having trouble, try opening up the URL in an incognito tab (disables caching) to see if it loads.
You can also try force reloading (don't use cached data) by using Ctrl + Shift + R.
If all of the above doesn't work, we recommend getting in touch with the customer service from your hosting provider. They handle WordPress and hosting configuration errors all of the time and may be able to easily pinpoint the issue and even walk you through fixing it.
This guide obviously doesn't cover all of the potential issues, but most of the time the errors fall into one of the above categories.
If you are getting a 404 error because you have decided to move your page or post. Or created a brand new post, but want visitors to your old URL to go to your new page, you can set up a 301 redirection on the old URL so your visitors automatically make it to the right resource.
Plugins can be a great option for handling 301 redirects. The Redirection Plugin will not only allow you to manually set up redirections, but it can also track 404 errors to help you find pages that don't exist, but have visitors.