Apache is a powerful and flexible HTTP/1.1 compliant
web server. Originally designed as a replacement for the NCSA HTTP
Server, it has grown to be the most popular web server on the
Internet. As a project of the Apache Software Foundation, the
developers aim to collaboratively develop and maintain a robust,
commercial-grade, standards-based server with freely available
source code.
The Apache HTTP Server is distributed at no charge for
commercial or non-commercial use. For more information read the LICENSE.txt file.
Apache can be used with Microsoft Windows. The
Apache HTTP Server Version 2.0 runs under Windows NT, Windows 2000 and
Windows XP. You should download the version of Apache for Windows with
the .msi extension. This is a single Microsoft Installer file containing Apache,
ready to install and run.
The latest Apache HTTP Server version can be downloaded from:
http://httpd.apache.org/
The latest Apache 1.3 documentation can be found at:
http://httpd.apache.org/docs/1.3/
The latest Apache 2.0 documentation can be found at:
http://httpd.apache.org/docs/2.0/
The latest Apache 2.2 documentation can be found at:
http://httpd.apache.org/docs/2.2/
Create custom error pages.
Information
When you click on a link and the page is not found, the visitor will see a
Not Found message.
The Apache ErrorDocument directive can be used to point the server to a customized file to send
in place of the builtin error message.
Operating system used
Windows XP Home Edition Version 5.1 SP 2
Software prerequisites
Apache 2
Procedure
- Create directory "error" in your docroot, e.g.: c:/mobilefish_web/error
- Create the following files in this directory:
401.htm
|
Authorization Required
|
403.htm
|
Forbidden
|
404.htm
|
Not Found
|
500.htm
|
Server Error
|
- Create in your docroot a file called
.htaccess (you must put a period in front of the filename), e.g.: c:/mobilefish_web/.htaccess
- The .htaccess file contains the following lines (of course you must put in your own domain name):
ErrorDocument 401 /error/401.htm
ErrorDocument 403 https://www.mobilefish.com/error/403.htm
ErrorDocument 404 https://www.mobilefish.com/error/404.htm
ErrorDocument 500 https://www.mobilefish.com/error/500.htm
Note:
If you use
ErrorDocument 401 https://www.mobilefish.com/error/401.htm
The Apache error.log will show the following log message:
cannot use a full URL in a 401 ErrorDocument directive --- ignoring!
This problem occurs in Apache 1.3.34. In Apache 2.0.49 this problem does not occur.
- Set directive AllowOverride All in the httpd.conf.
When this directive is set to All, then .htaccess files are NOT ignored.
Here below an example:
<VirtualHost 192.168.1.100:80>
ServerAdmin webmaster@mobilefish.com
DocumentRoot c:/mobilefish_web
ServerName www.mobilefish.com
ErrorLog logs/www.mobilefish.com-error_log
#TransferLog logs/www.mobilefish.com-access_log
CustomLog "|c:/weblogs/rotatelogs.exe c:/weblogs/
www.mobilefish.com-access_%y%m%d.log 86400" combined
<Directory "c:/mobilefish_web">
Options +Includes
AddType text/html shtm
AddOutputFilter Includes shtm
AllowOverride All
</Directory>
</VirtualHost>
- Restart Apache and try to access a non existing page.
|
|