.htaccess file-2

How to write .hatccess file

In the previous article .htaccess file we came to know how the .hataccess file works.In this article we will try to create a simple .htaccess file.The simple .hatccess file look like this:

Creating a .htaccess file may cause you a few problems. Writing the file is easy, you just need enterthe appropriate code into a text editor (like notepad). You may run into problems with saving the file.Because .htaccess is a strange file name (the file actually has no name but a 8 letter file extension)it may not be accepted on certain systems (e.g. Windows 3.1). Though, all you need to do is to save the file by entering the name as:

To ban the ip address we do the following:

SetEnvIf Remote_Addr ^A\.B\.C\.D$ banit
SetEnvIf Request_URI "^(/403\.html¦/robots\.txt)$"

The first line ban the ip address A.B.C.D and the second line allow the 403.html error page to open.

In the next article of .htaccess file we will look into password security and the file relation.