create 301 redirection using .htaccess

Very often we see an error report on our browser regarding 404 Not Found. Now a days most of the websites are using a beautifully styled custom error pages. You can easily set a custom error page with link back to your home page or other important pages using .htaccess. Let’s learn how to create custom 404 page using .htaccess.

How to create custom 404 page using .htaccess

STEP 1: Create a Web Page which you want to set as your custom 404 error page. Let’s say error404.php

STEP 2: Login to your cPanel Account. Upload it to your ‘public_html’ folder or to the root directory of your Website.

STEP 3: Open your .htaccess file in an editor & place the following code in it.

Options +FollowSymLinks
RewriteEngine on
ErrorDocument 404 https://www.yourwebsite.com/error404.php

Note: Replace yourwebsite.com with your domain name & don’t write the following codes if those already exists on your .htaccess.

Options +FollowSymLinks
RewriteEngine on
  • Was this article Helpful ?
  • yes   no

Leave a Reply