Thanks for the quick reply, Francis! My httpd.conf file doesn't have a single VirtualHost defined because I am using mod_jk to forward all the requests to Tomcat. Otherwise I understand how your solution would have worked. :)
I have alternate solution that involves changing Tomcat's server.xml (which I've outlined below). However, its not as clean as using mod_rewrite. Thanks, Shashi Change tomcat/conf/server.xml as follows.... <Host name="xyz.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="xyzredirect"> </Context> </Host> <Host name="www.xyz.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="wwwxyz"> </Context> </Host> Put following code in webapps/xyzredirect/index.jsp <% //send HTTP 301 status code to browser response.setStatus(response.SC_MOVED_PERMANENTLY); //send user to new location response.setHeader("Location", "http://www.xyz.com"); %> On Fri, Apr 11, 2008 at 12:48 PM, Francis Galiegue <[EMAIL PROTECTED]> wrote: > 2008/4/11, Shashidhar Rampally <[EMAIL PROTECTED]>: > > > Hi guys, > > > > I am trying to permanently redirect http://xyz.com to > > http://www.xyz.com, which is hosted on Apache2 + Tomcat 5.5.9 with > > mod_jk. I am trying to use .htaccess file to do so. So far my efforts > > have been unsuccessful! > > > > If I were you, I'd do a simple vhost for xyz.com: > > <Virtualhost xyz.com:80> > ServerName xyz.com > DocumentRoot /whatever/except/your/webapproot > RedirectMatch Permanent /(.*) http://www.xyz.com/$1 > </Virtualhost> > > And then define the Virtualhost for www.xyz.com, pointing to the real > webapp root, you see what I mean. > > I've been playing that trick before, and it worked. I think I'm > missing something though. > > > -- > Francis Galiegue, [EMAIL PROTECTED] > "When it comes to performance, weight is everything" - Tiff Needell > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]