Doing Wonders with Apache Settings

A Layman's Guide to Htaccess File

So you have decided to develop your own website and here I come to give you some rock solid advices which can do wonders for you. Before that I assumed that you are going to build your website on Linux-Apache-MySQL. Here you must know some basic working guidelines of Apache and
 PHP. The configuration of Apache web server is decided by a file called httpd.conf and all apache settings are written there. But apache allows you to modify these settings and you can easily override your apache settings to make it suitable for your purpose. Similarly, PHP settings are written in php.ini file and you can overwrite that too. To overwrite apache settings you need to place a file named .htaccess in your web folder. This htaccess file can overwrite httpd.conf settings. An htaccess file overwrites settings from down to top approach. That is htaccess file placed under /var/home/sites/includes can overwrite the htaccess file in /var/home/sites/ .

Trapping Error: There are five kinds of errors that one website can experience. These are

1. 400 Error (Bad Request): It means that a request for a URL has been made but the server is not configured or capable of responding to it.
2. 401 Error (Unauthorized Access): It means that a request for a URL is generated but the request failed to authorize itself as per security settings.
3. 403 Error (Forbidden Error): If any URL has been made for non-access and the request tries to access it, this error is generated.
4. 404 Error (Page Not Found): If any request for URL comes to the server which is not available then this error is generated.
5. 500 Error (Internal Server Error): For any internal error the server throws this error message to browser.

The wonder is that by adding a few lines you can get past the error message and can show your own custom error message. For this develop 5 html pages which will be shown in case these errors are generated. And then add these lines to it.

ErrorDocument 400 /400-page.html
ErrorDocument 401 /401-page.html
ErrorDocument 403 /403-page.html
ErrorDocument 404 /404-page.html
ErrorDocument 500 /500-page.html