When you type an address in the address bar of your browser, your computer receives files that your browser displays. The web server controls which files and how should be displayed (sent) to you. The two most popular servers are IIS and Apache.
Like any other software, a web server has certain settings. However, as an Apache user, you may have no (and if we talk about virtual hosting, most probably you will have no) rights to change the Apache configuration using its main configuration files that affect all server users. But you can modify some configuration files that affect only your website. One of such files is .htaccess.
It is a flexible Apache web server configuration file. "Flexible" means that as soon as you modify anything in this file, the changes are applied immediately. You can use it to redefine a lot of directives from the file httpd.conf (this file is the main configuration file in Apache and it affects absolutely all users of this Apache copy). In those cases when you have no access to the Apache configuration file (exactly in case of virtual hosting), it is this file that will help you.
A web user cannot access this file using the browser. If the .htaccess file is located in the root directory of the server, it affects the entire server except those directories where other .htaccess files are stored (and except all their subdirectories).
So how do you write or make .htaccess file?
Well, lucky for all of us there are hundred of websites that have tutorial or step by step to show us how to create that file, but one of the website that I like the most is

You don't have to remember all that syntax or codes, you just need to know what you need from you web server and select the right opition, this editor will automatic generate all the code for your .hataccess file.

