FOR IMMEDIATE SERVICE CALL:  866-566-HOST(4678)   
Web Hosting Provided by ProHosting.com - The Premier Web Hosting company in the world
  Our Services:
  Domain Services
  Virtual Web Hosting
  Programs:
  Promotions
  Member Referral
  Sales Agent
  Designer Directory
  Other Features:
  ParkPage
  About Us:
  Mission
  History
  Management
  Network
  Strategic Partners
  Site Directory
SUPPORT > .htaccess files:

What is a .htaccess file?
Setting alternate error pages(404 File not found etc..)?
Adding your own mime types
Displaying a directory index?
Where can I find a list of available commands?


What is a .htaccess file?

1. A .htaccess file allows you to customize the way the web server interprets your web pages. It is just a plain text file inside your html directory or another directory inside of your html directory. The . on the front of the filename tells the server that it is a system file, and it will be hidden from normal web file listings. You can name it htaccess, upload it, and then rename it to .htaccess Your site may already have a .htaccess file in it, and you can find out through your fileman utility inside NetAdmin ( https://netadmin.prohosting.com ) under the account category. If it already exists, you can edit it, and add the directive(s) you want (i.e. adding MIME types, etc)

2. Why does it start with a . ?

This is not specific to .htaccess files. Any file in Unix that starts with a . is considered a hidden file. In a normal directory listing, you won't see those files listed, because normally, they are files you don't need to see all the time, but files that need to be there, so Unix hides them.

Some FTP applications have Show Hidden Files command to show all the hidden files, but I haven't seen it work right in some. Just because you can't see it, however, doesn't mean the file isn't there.

For WS_FTP: If you use WS_FTP, in the Session Properties dialog's Startup tab, type -a in the Remote file mask field.

For Command-line FTP: If you use a command-line FTP (Dos, Unix), type ls -a to show hidden files in the directory listing.

3. How do I see/delete an .htaccess file?

As you may have noticed, you can't normally see the .htaccess file in the directory listing in your FTP application (see previous question). If your FTP application does not have a Show Hidden Files command (see previous question), or it doesn't work (never seems to for me), you can delete the file doing one of two things.

If your FTP application has a quote command, you can type in commands to the server (same for those using command-line FTP programs). Select the quote command and type (whichever works):

del .htaccess
or
site del .htaccess
The other way is to just upload a new .htaccess file with nothing in it to overwrite the old one, which works just as well.

Of course, keep in mind this works for any . hidden files, so be careful what you delete. With Unix-based machines, there may be a number of important hidden files laying around. Just be careful what you delete.


Setting alternate error pages(404 File not found etc..)?

To customize the page brought up when someone tries to access a web page that doesn't exist or a similar page, add a line to your .htaccess file with the following syntax:

ErrorDocument ### http://your_domain.com/alternate.html
where ### is the error number and alternate.html is the location of the html document you have designed to replace the default error document.

For example, to replace the 404 error page with the web page /usr/home/web/users/a9876543/html/404error.html add the following line:
ErrorDocument 404 http://your_domain.com/404error.html


Adding your own mime types

Certain browser plugins require you the server to have specific mime types set before they will work. The syntax for adding a mime type is:

AddType mime/type extension1 extension2 extension3

For example the mime type on the server for adding mpeg capabilities would look like:
AddType video/mpeg mpeg mpg mpe


Displaying a directory index?

When you access a directory which does not contain an index.html or index.htm file, and you would like it to list all of the files in that directory, you will need to add the following line to your .htaccess file:

Options Indexes Includes ExecCGI
(Includes and ExecCGI need to remain there to allow the execution of CGI scripts)


Where can I find a complete list of available directives?

There are many great forums out there for webmasters to share tips and tricks, as well as several reference websites. Check out the Apache homepage as well as the refcards.com list of commands.

CALL TOLL FREE: 866-566-HOST (4678)

ProHosting has hosted over 2,123,653 web sites since 1996!
 
Need Help NOW?

 

 
 
 
  866-566-HOST(4678)   Copyright ProHosting Corporation. All Rights Reserved. 
    Your use of this website constitutes acceptance of the ProHosting Privacy Policy and Terms & Conditions