Purpose and use of the .htaccess file Print

  • 0

The .htaccess file (note that the first character in the file name is a dot) is used to manage the Apache web server from the hosting end user. You place directives in this file that the web server accepts and processes, performing actions in accordance with the settings that have been made by the user.

The .htaccess file can be placed in the root directory of the web server (directly in the www directory, if the shared hosting service is in the httpdocs/ directory). In this case, the directives from such .htaccess are valid throughout the entire web server. Also, .htaccess can be located in a specific subdirectory of the server. Then the directives that are specified in this file “override” the action of directives from the “main” file, which is located in the directory (www, if the virtual hosting service is in the httpdocs/ 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 reread every time the Apache web server is accessed.


Was this answer helpful?

« Back