Routing: Displaying the Not Found Error

Let's show users a "Page not found" error when they provide a bad URL instead of redirecting them to the homepage.

Creating a new homepage script

When the user provides a bad URL, we should show them a “Page not found” error instead. The homepage shouldn’t be the default page, it should only show up if we actually go to http://APPLINK/.

First, let’s move the code for the homepage to its own file: public/homepage.php.

Get hands-on with 1200+ tech skills courses.