Let us start with definition and usage.
What is .htaccess?:
.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory and all subdirectories thereof.
Ref: About htaccess
Use of an .htaccess?:
An .htaccess file allows developers to execute a commands (Also know as directives) without requiring access to Apache’s core server configuration file httpd.conf(Also known as global configuration file).