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

The 404 error code is a very common error message. The 404 error indicates 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 webserver 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 webserver 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. Is shows the error 404 text like in the image:

404 error code in the browser

The cause of the 404 error code

Basically, the 404 error indicates that a file 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 webserver 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 text of the 404 error code to the user.

cause of the 404 error code

How do I fix the 404 error

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 of HTTP/1.1 Status Codes

Custom 404 error page

It’s possible to have a customized 404 error page, with your own text and images. In this article, we explain in details how to have a personalized page for the 404 error.

Some historic 404 error memes

Having a 404 error page shown on a website isn’t the end of the world. Many companies make fun of it. We have chosen a few memes as examples:

Conclusion

Basically, the 404 error text 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 *