Want to know about htaccess file. Check the given below points.
- Htaccess files are configuration files used in Apache web server that controls the directory that it “lives” in–as well as all the subdirectories underneath that directory.
- They are used to override the main web server configuration for a particular directory.
- For .htaccess files to work, the main Apache web server configuration option Allow Override must be enabled.
- If the Allow Override option is not switched on, then the .htaccess file configurations will not work and the main web server configuration will be applied.
- So before applying any configuration changes using .htaccess files always check that they allow Override option is enabled.
- The user must have appropriate file permissions to access and/or edit the .htaccess file. Further, .htaccess file permissions should never allow world write access — a secure permissions setting is “644”, which allows universal read access and user-only write access. Finally, .htaccess rules apply to the parent directory and all subdirectories. Thus to apply configuration rules to an entire website, place the .htaccess file in the root directory of the site.
- Features: .htaccess file include the ability to password protect folders, ban users or allow users using IP addresses, stop directory listings, redirect users to another page or directory automatically, create and use custom error pages, change the way files with certain extensions are utilized, or even use a different file as the index file by specifying the file extension or specific file.
- NOTE:.This file are very powerful and the slightest syntax error, such as forgetting a ‘<’ character, might break the functionality of your website. Therefore before making any changes to an existing .htaccess file always make a backup first. Once you apply the changes test your website thoroughly.