Apache HTACCESS File
3.9 | 33 Votes
What is an HTACCESS file?
An HTACCESS file is a configuration file used by an Apache web server that provides instructions for different directories of a website. "Htaccess" is short for HTTP access, which is the protocol used to transmit webpages.
A website's .htaccess file can be used to perform several important functions, including:
- Defining the index page of a directory (i.e. "index.html" or "index.php")
- Specifying the 404 (Page Not Found) error page
- Performing 301 or 302 page redirects
- Denying access from specific IP address or other websites
- Restricting access to certain directories and pages
- Executing MOD_REWRITE instructions
The .htaccess file is always named .htaccess and does not include a filename before the dot. It is placed in the root directory of a website and is processed by the web server each time a webpage is accessed.
The Apache .htaccess Tutorial includes additional information about how and when to use .htaccess files.
How to open an HTACCESS file
Because .htaccess files are plain text files, you can open and edit them with any text editor. To learn how to use an .htaccess with an Apache web server, refer to the Apache .htaccess Tutorial.