[Allstream]
Corporate Info  |  Contact Us  |  Français  |  Search:  
[Search]
 
Services & Solutions  |  Markets  |  Industries  |  Customer Care  |  Resources  |  About Allstream

Customer Care

  Home | Customer Care |

Business Support Internet

Ask An Expert

Other .htaccess configuration tricks

The Apache web server allows you to setup your own MIME types, custom error messages and more.

Custom error messages!

You can replace the default error message pages with pages of your own design. Doing this is as simple as creating your custom error pages and adding one directive for each type of error to your .htaccess file.

The most common error page is the 404 File Not Found error, generated when a user tries to access a non-existing URL at your site.

To configure the Apache server to show your custom error 404, you have to:

  1. create your custom error page and name it for example 404.html,
  2. create a directory on the server in the directory tree under htdocs and name it "errors",
  3. upload your custom error page into this directory,
  4. create an .htaccess file with the ErrorDocument directive and place it into your home directory.

Here an example of an .htaccess file configured for custom errors 404, 500, 401, and 403:

----------- BEGIN .htaccess ---------

ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html

----------- END .htaccess ----------

Here an explanation of each error code:

404 - File Not Found
500 - Internal Server Error
401 - Unauthorized
403 - Forbidden

Please find and example 404 error page here.

 

Adding MIME types!

MIME types ( Multipurpose Internet Mail Extensions ) help the server inform the browser what type of content is being received, so it can load the appropriate plug-ins and such. Our Apache server is configured by default for all popular MIME types. However, Apache's "AddType" directive offers you the ability to immediately add any MIME types that you might need to your account.

The following is an example of the "AddType" directive:

----------- BEGIN .htaccess ---------

AddType application/x-shockwave-flash swf

----------- END .htaccess ----------

NOTE: The Flash MIME type is actually preconfigured for your use -- it is included here for example purposes only.

For more information about MIME types please follow this link: http://www.oac.uci.edu/indiv/ehood/MIME/MIME.html

You can find a list of common MIME types here

Preventing Directory Listings

By default, the Apache server is configured to allow directory listings, i.e. your visitors are able to view directories that do not contain an index.html file. This behavior can be changed with the "IndexIgnore" directive. To prevent any of the files from being listed, create a .htaccess file in that directory with the following directive:

----------- BEGIN .htaccess ---------

IndexIgnore *

----------- END .htaccess ----------

The * symbol is a "wild-card" that matches all files, so none will be displayed.

For more information on htaccess configurations, please consult the Apache user's guide at http://www.apache.org/docs

 

 

 Usage Policies | Privacy Policy | Legal Disclaimer | Sitemap | Other MTS Allstream sites © Manitoba Telecom Services Inc., used under license.