- Custom error page
A custom error page is a feature of most
Web server software that allows you to replace defaulterror message s with ones you create. The default error messages tend to be fairly generic, and not particularly user-friendly, so making custom messages for a site is recommended.You can make them look more like the rest of a site, and/or provide better recovery navigation. The "Not Found" (404) error is the one users are most likely to encounter, so it is the most likely to be customized.
..::..Essa página que você está tentando acessar não existe..::..Visite nossa página principal em:
* [http://www.byfish.com.br]Custom 404 error message examples
* [http://www.cnn.com/blah News site (with "dashboard" navigation)]
* [http://europe.nokia.com/EUROPE_NOKIA_COM_3/Sorry/ Corporation site (with search and random pictures)]Creating custom error pages
The instructions below assume you have direct access to a Web server you set up. If your site is hosted by a third party, they may have already provided one or more default error pages. Check your host's documentation.
Custom error page creation using Apache HTTP Server
If you run a Web server using the
Apache HTTP Server software, you can easily specify custom error pages through server configuration files such as httpd.conf or.htaccess . You can specify custom error pages using the ErrorDocument directive. It is used as follows:---- ## File paths are relative to the Document Root (/) # '404 Not Found' error ErrorDocument 404 /404.htm # '403 Forbidden' error ErrorDocument 403 /my.htm # '401 Unauthorized' error ErrorDocument 401 /401.htm # Or.. # ErrorDocument 401 "The webserver could not authorise you for content access.----This may be put in an .htaccess file, which can be created using atext editor . Everything defined in an .htaccess file will only take effect for the directory it is located in and its child directories.It is important to note that the 401 error response must be a relative URL, beginning with a forward slash, /, or a comment, beginning with a double quote " due to the following in httpd_core.c :
if (error_number = 401 && line [0] != '/' && line [0] != '"') { /* Ignore it... */ ap_log_error (APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server, "cannot use a full URL in a 401 ErrorDocument " "directive --- ignoring!");
It's also very important that the 401 error response not only begins with a forward slash, there should also be no more than 1 (one) space between '401' and the forward slash /.
Custom error page creation using Microsoft IIS
#Use a text editor or an
HTML editor to create your custom page on your server
#From your server's desktop, launch the Internet Services Manager (usually located at Start->Programs->Administrative Tools->Internet Services Manager)
#Click the [+] to the left of the server name
#Right-click on "Default Web Server" (or whatever you may have renamed it as), and click on "Properties"
#Click on the Custom Errors tab
#Click on the number of theHTTP Error you want to make the custom message for, then click "Edit Properties"
#Use the Browse button to locate the custom file you created and click OK. Keep clicking OK to dismiss the windows, then close the IIS windowExternal links
* [http://httpd.apache.org/docs-2.0/mod/core.html#errordocument ErrorDocument Directive] in Apache HTTP Server 2.0 documentation
* [http://www.servergrade.com.au/faq/answers/creating-customised-404.html Customised 404 Error Pages] Improving website usability with customised 404 error pages
* [http://www.plinko.net/404/default.asp 404 Research Lab] Exploring the art of the 404 page
* [http://www.bigoakinc.com/blog/error-pages/ Error Pages] How to use a 404 Error Page
* [http://www.customerror.com Custom Error for IIS] Commercial Software for Error Page management on IIS 4+
* [http://research.elabs.govt.nz/good-practice-for-404-error-pages Research e-Labs] An article on 404 error page good practice
Wikimedia Foundation. 2010.