.htaccess Tutorial

The original writing could be found here. I’m just translating it to English. OK, here we go.

What is .htaccess

.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. In general, you should never use .htaccess files unless you don’t have access to the main server configuration file.
There are two main reasons to avoid the use of .htaccess files.The first of these is performance. The second consideration is one of security. (source)

What can .htaccess do

  1. Auto redirect
    Redirect /old-address /new-address
  2. Allow/Deny directory or list of directories
    Options -Indexes
  3. Allow/Deny specific IP address
    deny from all
  4. Alternative index file
    DirectoryIndex new-index-file
  5. Custom Error Page
    ErrorDocument errornumber /file.html

    Common error number :
    401 – Authorization Required
    400 – Bad request
    403 – Forbidden
    500 – Internal Server Error
    404 – Wrong page

  6. Folder protection
  7. Changing File Extension

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s