What is .htaccess ?
htaccess is a configuration file for use on web servers running the Apache Web Server software.
abbreviation from hypertext access
When a .htaccess file is placed in a directory of apache then the .htaccess file is detected and executed by the Apache Web Server software on prioirty.
.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.
This file is inaccessible through web.
You can create a .htaccess file using any good text editor such as TextPad, UltraEdit, Microsoft WordPad and similar (you cannot use Microsoft NotePad).
.htaccess is mainly used to rewrite urls
.htaccess example #1
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
it redirects every request to app/webroot
this file can be used to allow/deny access from specific ip
.htaccess example #2
order allow deny
deny from all
allow from 192.126.12.199
How to test it?
you can test ur .htaccess file here
http://htaccess.madewithlove.be/