404 error code: What is error 404 and how to fix

The 404 error code is a very common error message. That means that a specific page you tried to access a website doesn’t exist in the server. This error message is part of the HTTP/1.1 Status Codes definitions. Whenever you try to reach a page, the web server tries to find it in the local repository of files. If the server can’t find the file, or maybe if the file has a different name, then the server is unable to open the corresponding file. So, you will see the 404 error code in the web browser.

Basically, there are similar error codes, just like 500 (Internal Server Error) and 403 (Not authorized).  So, the web server throws them for different reasons. In this article, we will explore the causes of the 404 error code, and we will show you how to fix this. This error can happen both in HTTP or HTTPS servers.

the 404 error code

How the 404 error code looks in the browser

This is how the message is presented by default. There are methods to customize the 404 error page.

404 error code in the browser

The cause of the 404 error code

Basically, this error happens due to a file that doesn’t exist in the server. There are other causes like .htaccess configurations or wrong redirects that may apply. In this article, we will explore and explain the most common cause, which is a non-existent file.

For example, we will show a case of a user trying to access http://www.mysamplewebsite.com/filename.htm . In this request, the web server tries to find filename.htm in the local disk. By default, you must store the files inside the  public_html folder using FTP. As the file filename.htm doesn’t exist, the server shows the 404 error code to the user.

cause of the 404 error code

Fixing the 404 error code

Firstly, to fix the 404 error code you have to upload the file to the server. Make sure you place the file inside the public_html folder. In the following image, we will show the filename.htm uploaded by FTP to the server.  Now, the problem is gone and the URL of our example can be accessed without this error message.

You can see in this other article the complete definition about HTTP/1.1 Status Codes

Conclusion

Basically, the 404 error can be fixed at the FTP site of the server. The user has to make an FTP file transfer in order to place the non-existing files in the web hosting server. Also, in some times, the user needs to rename the files to adjust the file names with the links on the website.

 

Leave a Reply

Your email address will not be published. Required fields are marked *