DEV Community

Christopher Chhim
Christopher Chhim

Posted on

Avoiding the Dreaded 404

I am writing this blog to track my progress. I am currently on my second week of back-end development of my bootcamp and I am learning how to work with servers. We are starting to dabble on status codes such as: 200, 400, 401, 400, 500, etc... As I start to learn how to work with servers I want to know how to develop sites without prompting status code 404.

There are several ways to redirect users to a desired page. However, if it is done carelessly it will prompt status code 404, indicating that a bad request has been made. A correct URL would look like the following:

  • /supplements/spore-probiotic-6066

This is correct because it contains the name of the website and the ID.
ID = 6066

Incorrect but acceptable URL would look like the following:

  • /supplements/spore-probiotic

This will still redirect users to the desired URL despite having a missing ID.

  • /supplements/youtheory-spore-probiotic

The aforementioned link includes the brand name and a missing ID but will still redirect users to the desired link. This is because they are known as fallback methods and the database contains built-in methods in case such errors occur. While they not may be completely accurate, it is still within the server's capacity of understanding where the user should be redirected.

This post was inspired from:
Artz, L. (2024, June 10) Designing a website to not have 404s
Retrieved from: [https://pillser.com/engineering/2024-06-10-website-without-404s]

Top comments (0)