|
Informative Expert Articles from SimpleWebWork.com Learn to easily earn over $1057.50 in the next 30 days! |
|||
|
|
The Mysterious HTACCESS file Globally the Apache web server software is installed on almost two thirds of all servers, and with Apache come the incredibly powerful but very mysterious .HTACCESS file. Most people only use the file for simple password protection, but it can be used for much more than that. This article will help to show some of the possibilities that lie within your site's .HTACCESS file One of the neat features of the .htaccess file (please note, the filename must always be in lowercase), is that file can be edited on with almost any text based editor (such as the Windows Notepad). Controlling if files are downloaded or Opened in the Visitors Web Browser With the following code snippet, the site owner can determine how the file is download. This example (with files as .gz, .pdf, .zip and .rar) forces the file to be downloaded directly rather than having the browser attempt to open the file in the browser window. ForceType application/octet stream Allow only certain users access to the server based on their IP address The following code snippet allows only users of a certain IP address (in this case 27.101.84.200) access the the server. All other users are rejected. order deny, allow allow from 27.101.84.200 deny from all Deny Access to certain Files The following code snippet, determined what files can be access. In this example, all access to files starting with "." symbol are declined. This will stop people from access (or viewing) your .htaccess file deny from all Allow Server Side Includes on your Site This code line will ensure that files, which contain server Side Includes (SSI), will also get processed with they carry the .html file extension Addhandler server parsed .html Error Handling When an error occurs on your website, such as a person tries to access a file that does not exist, then the .htaccess file can display a "customized" error page for that particular error: For example: Error document 404 /404error.html Now when a user tries to access a file that causes a 404 error to be generated, the .htaccess file will now load an display the html file called 404error.html Please Note: This file must live in the root directory of your web site's structure (i.e. in a LINUX installation, in your /public_html/ folder). Sometimes Microsoft Windows has a problem with filenames that have a "." symbol as the first name. To overcome this simply upload the file as something different and then rename the file when its on the server.
|
||