The .htaccess file can be the single most important file to webmasters. You can control error documents (such as files not found), protect yourself from hot-linking, and password protect your sites.
The .htaccess file allows you to customize the "configuration directives" over directories and files found on your server. However, the .htaccess file really isn't a file at all. It's simply a file extension, like .html or .php, but this document has no name, so simply name it ".htaccess".
To create an .htaccess file open Nopepad and save the file as .htaccess. Notepad may add a .txt to the end, so just rename the file and remove the .txt extension. Normally a domain only needs one single .htaccess file in the root directory. If you place a second .htaccess file up one directory or more, then that .htaccess fill will overwrite the .htaccess file in the root directory of your site. Be careful, error document loops and bad formatting of the .htaccess file can cause infinite loops due to .htaccess file jumping
Once you have created your .htaccess file you will need to upload it to your server. An .htaccess file MUST be uploaded in ASCII mode and not BINARY. Now it's time to chmod (change the file permissions) your uploaded .htaccess file. Open your FTP program like WS-FTP or use a shell window like Putty. The standard "chmod 644 .htaccess" sets your file so only the server can read it. However some scripts (such as wordpress) want write permissions on the .htaccess file. If that is the case then "chmod 666 .htaccess". Some scripts ask that you chmod the .htaccess file to 777, I recommend against opening the file up to everyone.
- Related Links:
Apache Directives
Apache htaccess Tutorial
Htaccess Tools & Info
Htaccess File Creation Wizard





TrackBack URI:
Talking About: htaccess - guide & info - intro