Question: What Is .htaccess and How Do I Use It?
Apache HTTP Server by default is controlled by a single configuration file. On many Linux distributions, the file is called httpd.conf or something similar. If you have a shared hosting account, however, you do not have access to an Apache configuration file. Therefore, if you want Apache to behave a certain way when you are using it, you need to use .htaccess files.
The first thing to know about .htaccess files is that they are hidden. The period in front of the filename makes it a hidden file in Linux. When you type the command “ls” to list the files in a directory, you will not see hidden files. To view them, all you have to do is type “ls -a” which will show all files, including the hidden ones. If you do not have SSH access, you will need to configure your FTP client to see hidden files. The second thing to know about .htaccess is that the configuration options are virtually endless.
If you have a specific need for one, it is good to know how to find them. For example, with many content management systems, they use .htaccess files to create search engine-friendly URLs (i.e. changing index.php?2343546adf&thisandthat2343 to something like homepage.html). They usually provide the file as htaccess.txt. All you have to do is change it to .htaccess. You can do all sorts of things with .htaccess, from making custom Error 404 Not Found documents to setting up a password-protected directory. For an extensive tutorial of .htaccess features, see this site.