These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention, seo friendly url etc.
You can create a .htaccess file using any good text editor such as TextPad, UltraEdit, Microsoft WordPad etc. Extension of file must be .htaccess
Upload the .htaccess file to the directory you would like it to take effect over.
If your .htaccess file does not work check weather mod_rewrite module is enabled or not in you web server.
1) Type <?php phpinfo(); ?> in a php file and save it and run that file in the server.
2) And now you can the list of information, just search the word “mod_rewrite” from the browser’s search menu
3) If it is found under the “Loaded Modules” section then this module is already loaded as you see in the picture below, otherwise find the “httpd.conf” file under the “conf” folder inside the Apache’s installation folder. Now find the following line “#LoadModule rewrite_module modules/mod_rewrite.so” in the “httpd.conf” file.
4) Remove the “#” at the starting of the line, “#” represents that line is commented.
5) Now restart the apache server.
6) You can see now “mod_rewrite” in the Loaded Module section while doing “phpinfo()”.
If your .htaccess file does not work in server , you should contact your system administrator or web hosting company and ensure they have enabled .htaccess within your account.