The 404 Not Found error is the simplest and easiest to understand among HTTP errors. With a few exceptions, when encountering a 404 Not Found error, there are fewer areas to investigate, and the solution is usually quicker.
What is a 404 Not Found Error?
The translation of this error in Turkish is "Not Found." The web server returns a 404 Not Found error when it cannot find a page in response to the client's request. The request can be for a file, directory, or a specific URL. When the web server cannot return any response corresponding to the file, directory, or specific URL, it returns a 404 Not Found error.
Causes of the 404 Not Found Error:
A deleted file or directory.
A file or directory not transferred during website migration between servers.
Issues with the website's web server configuration file (.htaccess, httpd.conf, nginx.conf, or Web.config files being missing or having configuration errors).
The absence of mod_rewrite for Apache and/or rewrite modules for Nginx (though this is unlikely as modern software typically requires these modules).
If the requested address is an article or page within the website, and that article or page has been deleted.
Changes in the custom URL configuration.
How to Resolve the 404 Not Found Error:
First, you need to determine whether the requested address is a file, a directory, or a specific page provided by custom URL configuration.
For example, if a request is made for a file like hakkimizda.php, and the hakkimizda.php file is not present in the relevant directory on your FTP, you need to re-upload this file.
Another example could be if a request is made for a file like iletisim.html, and this file does not exist, but your software responds to this file through custom URL configuration, there might be an issue or missing configuration in your website's configuration file (.htaccess, nginx.conf, or Web.config).
Let's give another example: suppose you have an article on your website titled "How to Renew a Driver's License in 2021?" with the address https://www.yoursite.com/2021-renew-drivers-license/. If this article is deleted, you will encounter a 404 Not Found error. To resolve this, you can rewrite the article.
If a file or directory is missing, you need to re-upload these missing files from your website backup. If you have changed your custom URL configuration settings, you can try reverting them or fixing any issues in the web server configuration file handling your custom URL settings (.htaccess, nginx.conf, or Web.config).
404 Not Found Error and Solution for WordPress:
The 404 Not Found error for WordPress is usually encountered due to a missing .htaccess file (or missing configuration in the nginx.conf file if hosted on an Nginx server).
You can replace the contents of your existing .htaccess file with the following code or create a new one with this code if it doesn't exist and try accessing your site again.
If you already have an .htaccess file or if your Nginx configuration is correct, you can go to the Permalinks Settings in the WordPress admin panel under the Settings section and adjust your permalink settings.
You can check suitable Nginx configurations for WordPress and Nginx usage from this link.
If these steps do not solve your issue, you can check for missing files and directories via FTP.
Conclusion:
Since the 404 Not Found error is entirely due to missing files and directories, it can be quickly resolved by restoring the missing files and directories.