Purpose and use of the file .htaccess

File.htaccess (note that the first character in the file name is a dot) is used to manage the Apache web server from the end user of the hosting. You put directives in this file that the web server perceives and processes, performing actions in accordance with the settings that were made by the user.

File.htaccess can be placed in the root directory of the web server (directly in the www directory). In this case , directives from such .htaccess works across the entire web server. Also.htaccess can also be located in a specific subdirectory of the server. Then the directives specified in this file "override" the action of directives from the "main" file, which is located in the www directory or in any higher-level directory. That is, the action of the directive from .htaccess is inherited from top to bottom, but not vice versa. Changes made to the file take effect immediately. This is due to the fact that the information from .htaccess is re-read every time the Apache web server is accessed.