htaccess custom error page rewriterule parameters





htaccess custom error page


Htaccess redirect

Learn htaccess custom error page rewriterule flags , syntax using the sample example below.

Custom Error Pages

 Custom error pages are used to prevent people from seing  boring error message such as "Permission Denied" or "Page Cannot be Found"?  when ever a page is not found on a server or a page is not accessible. It is also used to remove boring server 500 , 404, 401, 403 error messages. You can liven up the error messages by creating custom error pages for each type of error you anticipate your visitors will encounter:
A 404 error message is the standard HTTP standard response code which is returned when the visitor cannot communicate with the server. This is a very common error on the web and it occurs when you are trying to visit a page which has either been deleted or has been moved somewhere else. For example, if you change the structure of your website and move a certain directory to a different part of your site, anyone trying to visit the old page url will get a 404 error message.
When you encounter A 404 error message the server will return page not found and additional information like this :
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7a mod_bwlimited/1.4 PHP/5.2.6 Server at yourwebsite.com Port 80.
This is annoying to a visitor if the cannot see what they are looking for. They will try to see other part of your site to see if the can locate the information. So it is good to create a custom 404 page that will guide the visitor and redirect traffic from incorrect urls.
So all you need to do is to create a custom 404 page like this http://www.yoursite.com/404.php  which will have information  like :
It appears you are looking for something which isn’t there. Either you have entered an incorrect URL or we have messed up. Why not visit our home page or alternatively, search for what you are looking for in the search box below.
Whilst a 404 error page does not send the visitor to the exact page they want, it does point them in the right direction and it means they are more likely to stay on your site.
Once you have your 404 page setup, all you need to do is send visitors to incorrect url’s to this page. To do this just add the following line to your .htaccess file :
ErrorDocument 404 /404.php
We have other errors on the server like 401, 403, 500 error messages etc. each of this error can be handled by creating custom page like this ones below in your htaccess file. Just create this pages on your server and add this line to your htaccess file.


ErrorDocument 401 /authorization.htm
ErrorDocument 403 /forbidden.htm
ErrorDocument 500 /servererror.htm

Custom error page is easy to create, to create custom error pages, replace the error code next to ErrorDocument to the appropriate error code, and change the URL of the page that you want the user to see when there is error.


htaccess custom error page syntax

htaccess custom error page code on this is provided for your study purpose, it will guide you to know how to use mod_rewite to create .htaccess files on the apache servers. use it to practice and train your self online

All the tutorials on this site are free, the page code is provifed for you to use it to practice, if you want to help to improve and maintain this work, you can donate to us on.



Htacess tutorial guides withexamples and easy steps to set ip up on your server.


Htaccess Generator

Htaccess force file save

ip blocking

adding new mime types and set timezone

cache control no cache and cache public

gzip page compression

block all bad robots

hotlink protection

redirect www to non www

stop directory listing

hide .

block and allow referrer

changing home directory page

upload_max_filesize limit

file access deny control

password protect a directory

hot to create file

php 301 redirect

custom error page

301 redirect

prevent hack

prevent directory listing

set cookie domain authentication

modifying the environment variable

All the tutorials on this site are provided for free. You can copy and print the tutorials and code on this site, but you are not allowed to reproduce this information on another website. All rights reserverd 2012

Copywright © 2013 www.htaccessredirect301.com Site created By prince Ejike Google+

promo