A really cool technique that many web designers overlook is the use of the .htaccess file. Whenever you see a custom error page (404, 403, etc.), use server side includes, restrict IPs, load a default page, or do any host of events invisible to the user, somebody is taking advantage of what a .htaccess file has to offer.
What is a .htaccess File?
A htaccess file is a configuration file that allows web servers like Apache to perform special functions when serving a HTML, php , asp, shtml pages etc. ".htaccess file" is a plain-text file that is save as .htaccess without any extra characters before or after the name of the file.
How to create create a htaccess file
.htaccess files are created by using a text editor on the server or by using notepad and save the filename as “.htaccess” . Just create your first .htaccess file by going to your server, in the file manager, click on new page and enter .htaccess as the file filename. That will create your htaccess file.
You can also create a htaccess file by using a text editor like notepad, click on file saveas and type “.htaccess” as file name with the quotation marks around the htaccess that will create you an empty htaccess file.
Applying .htaccess to Folders and Sub-Folders
Htaccess file controls the folder it resides on.This allows you to specify custom settings on a per directory basis if you really want it. Your .htaccess file doesn't need to be in the root directory of your web server. You can put it in any directory, and the settings specified by that .htaccess file applies to the current directory as well as any subdirectories
.htaccess file can be used to handle all kinds of cool tricks on the server that you probably never see.
Editing a .htaccess File
If you don't already have a .htaccess file setup, simply copy and paste the line(s) of code that you will see shortly into Notepad, save the file as .htaccess, and upload the file to the root directory of your web server.
Use a Dedicated FTP Editor
Note that IDEs like Dreamweaver and Expression Web may not show the .htaccess file at the root of your server. Use a more advanced FTP tool like FileZilla or SmartFTP to see the .htaccess file.
In the next many sections, you'll learn common .htaccess tricks and the lines of text you need to add to take advantage of them.