Purpose and use of the file .htaccess.


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


The .htaccess file can be placed in the root directory of the web server (directly in the www directory).
In this case, directives from such .htaccess are valid throughout the web server. Also .htaccess can 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 directives 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.


The basic guidelines can be found in a variety of online manuals, for example:
https://htmlweb.ru/php/htaccess.php