.htaccess File

servers htaccess file

What is the .htaccess File

The .htaccess file is a file that gives commands to apache servers. Windows servers use a similar file called the web.config file but we will only be discussing the .htaccess file in this article.

The .htaccess file is placed in the top level of a websites domain and the server will automatically detect this file and follow the instructions given within. Through inserting certain instructions into this file you can redirect users from one page (or domain) to another, create a personalised 404 error page, password protect folders or allow access to specific users based on their IP address.

Creating your .htaccess file

Creating your .htaccess file is quite simple.

  1. 1. First thing you need to do is to create a new file in notepad
  2. 2. Go to file and then save as.
  3. 3. In the File Name field enter “.htaccess” (including the speech marks as shown in the image)
  4. 4. Press save.

That’s it you have created your .htaccess file and from now on you can just save that file in the normal way. If you didn’t include the speech marks then notepad would just create it as a text file which couldn’t be read by the server.

This file then needs to be uploaded to the root directory of your domain using an ftp client such as filezilla or Dreamweaver etc. now all the commands placed in the file will be read by the server.

Read these articles for information on .htaccess commands

Enabling GZIP Compression

Creating Redirects