-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mathias,

Mathias P.W Nilsson wrote:
|> If, as I suspect, you *do* own MYSITE.COM, you just need to set up a
|> default virtual host and have it redirect to WWW.MYSITE.COM.
|>
|
| How can I do this? My web app points to ROOT.war.
|
| <Host name="localhost"  appBase="webapps"
|             unpackWARs="true" autoDeploy="true"
|             xmlValidation="false" xmlNamespaceAware="false">
|               <Alias>www.mysite.com</Alias>
|               <Alias>mysite.com</Alias>
|       </Host>

Unfortunately, Tomcat doesn't really have anything like Apache httpd's
"RedirectPermanent" directive that you can assign at the server (or
virtual host) level. Instead, you have to create a tiny webapp that does
this for you:

1. Create a <Host> that matches only "mysite.com" and does not alias
www.mysite.com. You might want to make this one the default, so you
catch any other hostnames that come in.

2. Create a ROOT webapp for that host and ...

3. Use a url rewriting library like http://tuckey.org/urlrewrite/ or
write your own simple redirection code

4. Deploy your real application on a the <Host> that matches only
"www.mysite.com".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhf+ZAACgkQ9CaO5/Lv0PA5CACdFkkRK9c5+i9KPhgMb+y61jM4
x9MAnRJ1kSm4FJlTMr1mC4ArhQS2Rs6j
=FVve
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to