Redirecting your IHS root context to your WebSphere app Server app

Off
Strongback Consulting

When you install WAS,  you’ll probably also be installing IBM HTTP Server (you should if you use web apps). However, you may want that HTTP server to automagically navigate to your preferred WAS java app. Otherwise, if your users navigate to the default hostname (http://www.myhostname.com), they’ll see the ugly IBM HTTP Server welcome page with links to nothing else.

Let’s say you want them to instead go to http://www.myhostname.com/MyApp, but don’t really want to have to give them the URL with the root context. First, make sure the application is up and running on WAS. Also, make sure you’ve mapped the web module to the IHS server in the admin console.

Now, go to the htdocs directory under your HTTP server install root (c:IBMHTTPServerhtdocs). Create a file called .htaccess (yes a period before the name). Add the following to the file:

Redirect 301 / http://www.myhostname.com/MyApp

You can also type the following on a Windows command line to do it all in one shot:

C:IBMHTTPServerhtdocs> echo "Redirect 301 / http://www.myhostname.com/MyApp" > .htaccsss

Next, open your httpd.conf file located in the ‘conf’ directory under IHS. Edit the ‘AllowOverride’ line from ‘None’ to ‘All’. This assumes that you are only using IHS to front end your WAS server. If IHS is hosting more that just WAS apps, you’ll need to do some more homework on this.


#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

This is called a permanent redirection, and any web crawlers will automatically update their search engines. It is faster than embedding an http redirect in the index.html, and more reliable.

Now, restart IHS, and voila! Your default host name now refers you directly to your installed WAS app.

If you find you need to do more with IHS than that, here’s a few links to help you out:

Do you have the resources to manage your own WebSphere environment? Need some mentoring assistance to get you up to speed?

Comments are closed.

Strongback Consulting