.htaccess is a configuration file used on web servers running under Apache Web Server software. The .htaccess file is to put into the directory which is in turn “loaded by Apache Web Server”, after that the .htaccess file is defined and executed by the software. Such files can be used to modify the configuration of Apache Web Server software. This enables/disables the additional functions. These options include the basic redirection functionality in case the 404 error “file not found” appears. It is also used for more complex functions like content password protection or prevention of direct links to images.

How does it work?

'.htaccess' is the full name of the file and not an extension. This file works in any directory that is in turn runs under the Apache Web Server software. The file spreads its activity over the whole directory where it is placed and also over all files and subdirectories within the certain directory.

How to add .htaccess file:

  1. The file can be created with any good text editor like TextPad, UltraEdit, Microsoft WordPad, and others similar to them (but do not use Microsoft NotePad).
  2. As soon as the file is created you need to upload it. This should be done with an FTP-software.
  3. Upload the .htaccess file into the necessary directory. Then go to the directory through the web browser as if you needed to look through any document on your website and check its functionality.
  4. After the file is uploaded it may not appear in the directory files list. But that’s ok, this means the FTP server has hidden it and it won’t cause any problems.
Leer también