Htaccess is short for Hypertext Access and it's simply a configuration file that specifies permissions for a directory or folder on a web server. A webserver is just like any home computer that you use daily and uses a folder structure to store files in the same way. But instead of using Windows (as most home users do), a webserver is most often using an Apache based operating system. Apache allows for the most flexibility and power on a web server and this is why it is most often used to serve web pages.
An htaccess file is placed at the root of your website and gives instruction on what you will allow others to see on your website. It's a very powerful and useful feature that can allow you to perform many simple tasks such as redirecting an old page to a new page, password protecting a directory, keeping a search engine from browing a directory and much more.
The given name of the file on your webserver must be set as .htaccess so that Apache will find it and use it properly. Editing the file is as easy as downloading it with your FTP client, making changes in notepad and uploading it back to your server. It's just a very small text file.
Understanding what an .htaccess file is used for is quite easy to understand. Unfortunately, gaining the knowledge to edit the file properly can often require a steep learning curve. Website owners that only have a background with Windows operating system often find the task much more difficult than expected.
If you have a specific need for editing the .htaccess file, be absolutely sure to start by making a backup of your original file. Be aware that htaccess if highly sensitive. One missing character will render the file useless.
If you would like to edit an .htaccess file, visit the online .htaccess editor here. This utility will save you a lot of hours and lessen your learning curve to a great degree.
Be aware that many web hosts will not allow you to have access to your .htaccess file. I recommend not using a web hosting company that doesn't allow for this as more advanced website administration will often require it. Furthermore, you may find that your FTP client doesn't "see" your .htaccess file. It's often marked as "hidden" and many ftp clients are set to hide hidden files by default. An example is the FTP client I use. Ipswitch WS_FTP Pro has long been my favorite. To view hidden files with this utility, you will need to go to 'Site Options', 'Startup' and add a "-a" to the 'Remote file mask'. This may sound tricky if you're not familiar with the program but it's just a simple option that can easily be edited in the program interface.
It's also never a good idea to let someone see your .htaccess file. To prevent someone from viewing an .htaccess file, simply add the following to your .htaccess file:
An .htaccess file also allows for the use of the wildcard. A wildcard is simply an asterik (*) that you can use to stand for one or more characters. This makes it easy to specify multiple directories. For example, if you put 50 images in a folder called /images, you probably don't want others going to that directory and looking at every image (making it easy for them to steal images from your website). One option is to create a blank page and call it index.htm or index.html and upload it to the directory. A blank page will then always be served if someone browses to that directory. But let's say that you don't want to have to upload a blank page to every image directory. You could simply add the following to your .htaccess file:
This would stop all gif, jpg and png images from being displayed. Instead of naming each file, we use an asterik as the wildcard, which replaces all characters of each image type.
I encourage you to stop by and try out the Web-Design101 .htaccess editor if you need to edit your .htaccess file. Simply create your file and copy and paste the result right to your file, upload it to your website and you're done!