Create a custom 404 Error Page in php using htaccess
How to Create a custom 404 Error Page in PHP using htaccess
In this tutorial, you will learn how to create a 404 error page in php using htaccess.
We will be using this 404 Error Page in websites. When the requested url or page is not found, we will display the 404 Error Page, which we will be doing in php using htaccess file. So, Let's get started:
We will be using Bootstrap v5 to design the 404 Error Page.
Step 1: Create a file named 404.php and paste the below given design:
Step 2: Create dot . htaccess file in your root folder and paste the below code:
and now, lets try to access wrong page or url as https://www.yourdomain.com/testing-wrong-url.php
your will be redirected to your 404.php page.
Thanks for reading.