How to create htaccess file Level of difficulty:
A htaccess file is a simple ASCII file, which can be created through a text editor like Note pad or by means of a simple text. The file extension is .htaccess . In order to make such a file, the following procedure has to be followed. Materials Needed:
- Specialized software
First of all open up a text editor and save a blank page as .htaccess. If saved in a note pad it will save as file .htaccess.txt).
Remove the .txt or other file extension
Right click on the file and rename it by removing anything that doesn't have .htaccess. It can be renamed via telnet or the ftp program, and enough familiarity with one of those is very important.
Few things to keep in mind: htaccess files have to be uploaded as ASCII mode, not BINARY. It is necessary to CHMOD the htaccess file to 644 or (RW-R--R--). by which it becomes convenient for the server to use. But it is equally true that the browser finds it difficult to read and security can be seriously affected even in case of directories which are password protected, because if a browser can read the htaccess file, then the location of the authentication file can be easily retrieved and any portion which has been previously protected can be fully accessed. By placing the authentication files above the root directory, this can be prevented and also by giving a htaccess series of commands which prevents the browser to access
Most commands in htaccess have to be placed on one line only, so if you use a text editor that uses word-wrap, make sure it is disabled .
The directory in which htaccess are placed is affected by htaccess along with other subdirectories. So it is advisable to place a new htaccess file within the directory which one doesn’t want to be affected with changes . By removing the unwanted specific command(s) from the new htaccess file the directory can be saved. Thus the closest htaccess file to the current directory is treated as the htaccess file.
There is a possibility of infinite loop of redirects or errors to occur if something wrong in the htaccess is placed. However, creating a .htaccess file may be problematic sometimes. Writing the file is easy, you just need an appropriate code which has to be entered into a text editor (it can be a notepad).