The main advantage of using .htaccess is to protect access to directories. When you have a situation to keep files private, or to be accessed only by a set of members, we can apply htacces at those times. We can make each files in a directory as password protected.
For instance, in order to try it locally, try the following code. We need to create a username and password file first. It looks like
We can have any number of users in the list.
In the .htaccess file include the following lines
AuthName “Admin Area”
Here we have to specify the path of the password file. It can be located anywhere in the server.The first line denotes the message to be displayed as the title of the pop-up box.
The popup box appers as follows in firefox
Latest posts by Nagarajan (see all)