Wednesday, February 4, 2015

Setting 404 error page via. htaccess


In this topics we will discuss on setting up a custom 404 error page using .htaccess file. This will allow you to message visitors who request a page that not exist on your site.

You can create a static 404 html page to show custom message for 404 error. You can show your custom 404 page via .htaccess file.

It is very easy way to edit .htaccess page. If your site have no .htaccess page create a new .htaccess page. Then write necessary code for your site. To execute described process follow the below steps.


Step - 1 : Login to your cpanel.

Step - 2 : From cpanel Dashboard Files scetion click on File Manager.

Step - 3 : Select Document Root for: Option.
Step - 4 : Check Show Hidden Files(dotfiles).
Step - 5 : Click on Go button.

Step - 6 : Right Click on .htaccess file (if exist) and select Edit or Code Edit.

Step - 7 : If not exist .htaccess file then click on New File from top menu. In the New File Name text box write .htaccess then click on Create New File. Then right click on .htaccess file and select Edit or Code Edit.

Step - 8 : Now you can write a custom message for 404 error as below.
ErrorDocument 404 "Requested page not found."
Step - 9 : Or if you want to show from your custom page then write the code as below.
ErrorDocument 404 /404.php
[For Step-9 you must create a 404.php custom page]
Now go to web browser and write your site name and write a page name that not exist on your site. It will show you your created custom 404.php page as 404 error page.

1 comments :

  1. Thank you Mahabubur, this was what I have been exactly looking for. I needed some on-line help during my training to train students practically and was looking for some good site that would help.
    Java Training in Chennai | Java Training in Chennai | Java Training in Chennai

    ReplyDelete

 

Copyright @ 2014 Tech Tutorial .