JSP Hosting
 

HostingServicesSupportOrderAbout UsSoftwareHome


Even experts read the manuals. Our tech support staff has most of the books that are out on a wide variety of web topics. Here are some of their top picks. We think you'll find them useful and informative as well.

 



Apache .htaccess directives

The Apache web server is highly configurable using .htaccess files. These files let you add password protection, SSIs, URL rewriting and more to individual directories on your web sites. However, these files are not used by Tomcat for JSP or servlet-based files.

NOTE: .htaccess files are not recognized when a site is served directly as a Tomcat context. Tomcat has similar functions which can be enabled through Tomcat's server.xml and web.xml files. See Tomcat role-based password protection.


Controlling index listings

By default, the Apache server displays a listing of files when no index file exists in a directory. On some directories, you might not want this behavior. To turn off index listings, create a file called .htaccess in the desired directory containing the following text:

Options -Indexes

This will turn off index listings for the directory and all subdirectories.


Enabling Server Side Includes (SSIs)

Because they increase the amount of processing required to serve files, Server Side Includes are turned off by default. If you want to run SSIs in one of your directories, you can enable them by creating a .htaccess file with the following text:

Options +Includes
AddHandler server-parsed .shtml
AddType text/html shtml


This will cause any file named with a .shtml extension to be processed first by the server.

URL Rewriting

If content moves from one directory to another, you can have Apache automatically redirect the requests using a RewriteRule. An example might look as follows:

RewriteEngine on
RewriteRule ^olddirectory(.*) /newdirectory$1 [R]


This would cause any request for pages inside /olddirectory to be redirected to the equivalent page in /newdirectory. RewriteRules can be used for a wide range of configuration requirements. They are documented in greater detail in the Apache Server Manual.


Important: An improperly configured .htaccess file can cause your site to become inaccessible. Always test your site's reachability after making any .htaccess file changes.

 

Note: MMA technical support staff cannot provide troubleshooting of problems with third-party CGI scripts including but not limited to: Perl scripts, C/C++ binaries, PHP or web/database integration unless these services are specifically contracted. For these services, please see our Quote Request Form.



Copyright © 1995-2012
Motivational Marketing Associates, LLC
All Rights Reserved.