.htaccess is a Unix/Linux based file for Apache web servers that allow you to change access permissions and many other things for files on your web server.
To make a .htaccess file, open up an html editor, preferably notepad, and enter your commands(each on a seperate line). When saving your file in Notepad, enter .htaccess as the file name and choose All Files for save as type. It is very important that you don't save it as a .txt file.
When the .htaccess file is placed in the root directory, it will also affect all other directories below it. If you place it in a subdirectory it will affect all the files of that directory. Note that any .htaccess file in the root directory will override those in subdirectories.
When uploading your .htaccess file through ftp, make sure you are in ASCII mode, not binary. Most web servers will hide all of the files that start with a period. In order to view your .htaccess file in ftp, your will need to place -la or -al as shown to the left using WS_FTP. If you are using an ftp other then WS_FTP, you may need to check your help files to find out what method you need to use.
In order to prevent others from viewing the contents of your .htaccess file, place the following in the file.
<Files .htaccess>
order allow,deny
deny from all
</Files>
Related Articles
- Password ProtectionAlthough there are many uses for a .htaccess file, by far the most popular, and probably most useful, is being able to reliably password protect directories on websites. Although JavaScript can also be used to do this, only .htaccess has total security, because someone must know the password to get ...
- Prevent Directory ListingWhenever you have folders with large amounts of files or important administration files, it is essential to prevent directory listings, otherwise all of the files in the folder will be listed to anyone who wants to see them, including hackers. When hackers can find an administration file, it makes t...
- No Direct LinkingIf you want to prevent those awful direct linkers, use this tutorial. Open up your notepad (start>>programs>>accessories>>notepad) or another text editor, and copy the code below to it. Name this file .htaccess and make sure it doesnt have an extension on the end, like .txt. If i....
- RedirectionHave you changed the navigation structure of your website by moving or deleting pages of your site? If a visitor has the old page bookmarked or comes from a link on another site to it, they will receive a 404 error; page can not be found. Solve this by redirecting the visitor to the new page. The me...
- Introduction to HtaccessWhat is
- Change Default Directory PageA directorys defauly page is usually index.html, index.htm, or index.php. Therefore, when a visitors goes to www.domain.com they are automatically redirected to www.domain.com/index.html.
With .htaccess the default directory page can be changed.
Open your .htaccess file or create a new one. .... - Gain More Web Site Control With .htaccess!There are many tools of the trade in the world of Web site development, but very few have as many good uses as your .htaccess file. What, you dont have one? Ill admit, information on these little darlings are confusing to some and hard to find...
- Hotlink ProtectionBandwidth theft or hotlinking is direct linking to a websites files (images, video, etc.). An example would be displaying a JPEG image you found on someone elses web page so it will appear on your own site, journal, weblog, forum posting, etc.
- IP Banning1. Make a new text file and name it .htaccess or open one you already have.
2. Find out the persons IP address and substitute it for 000.000.000.000.
To deny access..
deny from 000.000.000.000
To allow access..
allow from 000.000.000.000
To ban everyone..
deny from all
To add mor.... - Error PagesThe standard error pages can be very annoying. When you move a page in your site, visitors have no way of finding where you moved it to in the error page. With custom error pages you can get cool error pages that have the same layout as your site and get rid of the standard ones and replace them wit...
