a digital blog

HTACCESS, PHP, Tutorial

Custom Error Pages Using HTACCESS

Custom Error Pages Using HTACCESS

Custom Error Pages Using HTACCESS

This post explains how to create Custom Error Pages with .htaccess mod redirection. Before trying this you have to enable mod_rewrite.so module at httpd.conf.

For more information about htaccess and mod_rewrite go to my previous tutorial  http://www.91weblessons.com/what-is-htaccess

We can  use custom error pages for any error as long as you know its number by adding the following code in htaccess file.

RewriteEngine On
ErrorDocument 404  /pageNotFound.html

In this htaccess rule if the file is not in the root directory of your site, url will be redirect to pageNotFound.html.

These are some of the common errors:

400 – Bad request
401 – Authorization Required
403 – Forbidden
404 – Wrong page
500 – Internal Server Error

 

10 Comments

  1. Really fantastic info can be found on blog .

  2. Fantastic catch. Thanks.

  3. I just want to say I’m newbie to weblog and actually loved your website. More than likely I’m going to bookmark your website . You certainly have really good writings. Thanks a bunch for sharing with us your website page.

  4. Jeffrey Hoberek

    I was seeking this particular information for a long time. Thank you and good luck.

  5. This excellent website truly has all of the
    information and facts I needed concerning this subject and didn’t know who to ask.

  6. Wow, amazing blog layout! How long have you been blogging for?

    you made blogging look easy. The overall look of your website is fantastic,

  7. Very good info. Lucky me I recently found your website by accident (stumbleupon).
    I have saved it for later!

  8. Hey there! I’ve been following your website for some time now and finally got the bravery to go ahead and give you a shout out from Houston Tx! Just wanted to mention keep up the fantastic work!

  9. Its such as you learn my thoughts! You seem to grasp so much about this, such as you wrote the guide in it or something. I feel that you can do with some p.c. to power the message house a bit, but instead of that, that is excellent blog. An excellent read. I will certainly be back.


*

Copyright © 91 Web Lessons - a digital blog