Introduction of .htaccess

Article written by:
  • Hosting Guides
  • Updated: Jun 05, 2015

What is .htaccess?

It’s a directory level configuration file that can be placed in a directory to customize the configuration for different requests to the particular directory. .htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

Why It Starts With dot [.]?

This is because [.] files are by default hidden files on Unix and Unix like operating systems, and since it’s a configuration file so it must be hidden.

What Does It Do?

  • It specifies the security restrictions for the particular directory.
  • It helps showing custom error responses, i.e. 404 ‘Not Found’, 403 ‘Forbidden’ etc.
  • Helps URL rewriting, i.e. you’ve a bad URL structure like, and you want it to be like www,
  • Helps the server to control User agent caching to reduce bandwidth usage

When To Use .htaccess?

If it’s a server with multiple users, i.e. a cheap shared hosting plan, users may want the ability to alter their site configuration. But remember that these users should not have access to the main server configuration files.

When Not To Use .htaccess?

If users have direct access to the server and you’re allowing individual users to modify the configuration, it may affect security.

Visit to learn more on usage and application examples of .htaccess file.

Article by Jerry Low

Geek dad, SEO data junkie, investor, and founder of Web Hosting Secret Revealed. Jerry has been building Internet assets and making money online since 2004. He loves mindless doodling and trying new food.

Get connected: