Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-14 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francis,

Francis Galiegue wrote:
| 2008/4/12, Christopher Schultz [EMAIL PROTECTED]:
|  Sorry to pick nits, but the fallacy that Tomcat sucks as a static
|  content server just needs to die.
|
| Well, the performance tests we did (Tomcat 5.0.x/Coyote vs Apache
| 2.0.x/AJP13/Tomcat 5.0.x) surely didn't account for it being a
| fallacy. I don't know whether this has changed in 5.5.x/6.x, but
| Coyote doesn't know about mod_expires and keepalive, for one. And that
| makes a huge difference.

Could you please send a link to the data and those findings? I'm sure
everyone on the list would love to ask questions. If you wouldn't mind,
please post it under a new heading so folks will actually read it.

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

iEYEARECAAYFAkgDeY8ACgkQ9CaO5/Lv0PB1jwCfcygWJuaGtND3lZQZOwq0+mYK
kZYAoLuyEfbOjf0k5y9tLrx4WYzDy5Kd
=Y16Z
-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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-13 Thread Francis Galiegue
2008/4/13, Shashidhar Rampally [EMAIL PROTECTED]:
[...]
  Also when I tried to replace one VirtualHost with multiple
  VirtualHosts (and hence not needing mod_rewrite), I am getting the
  following error message:
  [warn] VirtualHost xyz.com:80 overlaps with VirtualHost
  www.xyz.com:80, the first has precedence, perhaps you need a
  NameVirtualHost directive


Have you put a NameVirtualHost your.ip.add.ress:{443,80} before
defining your virtual hosts?

-- 
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-13 Thread Shashidhar Rampally
Finally I figured it out! I had to read about VirtualHost and
NameVirtualHost in the Apache manual, which I was trying to avoid. :)

Here's my final configuration. I have used both RewriteMatch and
mod_rewrite (just to to remind myself it can also be done both ways).
For now, I have chosen not to worry about serving static content
through Apache.

Thanks for all the help Francis! :)

Regards,
Shashi

/*httpd.conf  (only relevant portion) */
Listen 80
Listen 443

LoadModule ssl_module modules/mod_ssl.so

NameVirtualHost *:80
NameVirtualHost *:443

VirtualHost *:80
JkMount /* ajp13
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{http_host} ^xyz.com [nc]
RewriteRule ^(.*)$ http://www.xyz.com$1 [r=301,nc,L]
RewriteCond %{http_host} ^abc.com [nc]
RewriteRule ^(.*)$ http://www.abc.com$1 [r=301,nc,L]

/VirtualHost

VirtualHost *:80
JkMount /* ajp13
ServerName www.xyz.com
RedirectMatch permanent ./*specsheets.html$ 
http://www.xyz.com/specsheets.jsp
RedirectMatch permanent ./*locations.html$ 
http://www.xyz.com/contactus.jsp
RedirectMatch permanent ./*mission.html$ http://www.xyz.com/aboutus.jsp
/VirtualHost


AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl.crl
SSLPassPhraseDialog  builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

VirtualHost *:443
ServerName *.xyz.com
JkMount /* ajp13
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/httpd/conf/ssl.crt/_.xyz.com.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/xyz.key
SSLCertificateChainFile 
/etc/httpd/conf/ssl.crt/gd_intermediate_bundle.crt
/VirtualHost




On Sun, Apr 13, 2008 at 11:38 AM, Francis Galiegue [EMAIL PROTECTED] wrote:
 2008/4/13, Shashidhar Rampally [EMAIL PROTECTED]:
  [...]

   Also when I tried to replace one VirtualHost with multiple
VirtualHosts (and hence not needing mod_rewrite), I am getting the
following error message:
[warn] VirtualHost xyz.com:80 overlaps with VirtualHost
www.xyz.com:80, the first has precedence, perhaps you need a
NameVirtualHost directive
  

  Have you put a NameVirtualHost your.ip.add.ress:{443,80} before
  defining your virtual hosts?

  --


 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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-12 Thread Shashidhar Rampally
Francis,

I have followed your suggestion of using a VirtualHost but also made
use of a suggestion I found on a website which talked about putting
mod_rewrite rules inside the VirtualHost element along with the
JkMount command inside. And wow! it works great. :)) Thank you!

The only thing that's still unsolved is how do I redirect aboutus.html
permanently to aboutus.jsp (and 9 more such pages). I can follow the
same concept and put all those rules inside the VirtualHost, but I was
wondering if that would have performance implications? Is there anyway
I can .htaccess into play?

Thanks,
Shashi

VirtualHost *:80
JkMount /* ajp13
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{http_host} ^xyz.com [nc]
RewriteRule ^(.*)$ http://www.xyz.com$1 [r=301,nc,L]
/VirtualHost



  On Fri, Apr 11, 2008 at 3:53 PM, Shashidhar Rampally
  [EMAIL PROTECTED] wrote:
   Francis,
  
Sorry if I offended you.
Those links are
www.xyz.com/specsheets.html - www.xyz.com/specsheet.jsp
www.xyz.com/aboutus.html - www.xyz.com/aboutus.jsp
www.xyz.com/mission/mission.html moved to www.xyz.com/mission.jsp
etc.
  
No, I do know anything about mod_proxy. I will look into it right away.
  
Thanks,
Shashi
  
  
  
  
  
  
  
On Fri, Apr 11, 2008 at 3:28 PM, Francis Galiegue [EMAIL PROTECTED] 
 wrote:
 2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:

  Francis,
  
I placed the following in httpd.conf. However, the next time I 
 visited
xyz.com, it took me to Tomcat home page.
VirtualHost xyz.com:80
   DocumentRoot /not/a/valid/folder
   ServerName xyz.com
  
   RedirectMatch Permanent /(.*) http://www.xyz.com/$1
  
   /VirtualHost
VirtualHost www.xyz.com:80
   DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
   ServerName www.xyz.com
/VirtualHost
  
  
Your's is not a comprehensive/clean solution. We also moved about 10
links. So I also wish to permanently redirect these HTML pages too.
  
So what would really help me is a URL rewriting module/plug-in like
   mod_rewrite.
  

  Please clarify. What are these 10 links? Individual files or whole
  directories/webapps?

  Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?

  --


 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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-12 Thread Francis Galiegue
2008/4/12, Shashidhar Rampally [EMAIL PROTECTED]:
 Francis,

  I have followed your suggestion of using a VirtualHost but also made
  use of a suggestion I found on a website which talked about putting
  mod_rewrite rules inside the VirtualHost element along with the
  JkMount command inside. And wow! it works great. :)) Thank you!


No problem :) But see below.

  The only thing that's still unsolved is how do I redirect aboutus.html
  permanently to aboutus.jsp (and 9 more such pages). I can follow the
  same concept and put all those rules inside the VirtualHost, but I was
  wondering if that would have performance implications? Is there anyway
  I can .htaccess into play?

  Thanks,
  Shashi

  VirtualHost *:80
 JkMount /* ajp13

Why /*? Why not only /*.jsp? Apache is much better at serving static content...

Here is the Apache configuration file I use, from a server at home
(hence the RFC 1918 address and nonsensical domain name), you'll
notice that I don't use mod_rewrite at all and that one URL
(/favicon.ico) is redirected using RedirectMatch. You can use this
trick for your yet unredirected pages.

Before the end of the file, you'll see how I manage to redirect
another server name to the main one, it's dead simple. Again, no
mod_rewrite needed ;)

 CUT 
##
# TOMCAT #
##
#
# We use mod_jk for talking with Tomcat. Note that this module does NOT come
# from RHEL, but from JPackage.
#
LoadModule jk_module modules/mod_jk.so

#
# The JkWorkersFile is the location (starting from the ServerRoot) of the
# configuration file for mod_jk.
#
# In a traditional One2team setup, only one worker, of type AJP 1.3 and with
# name ajp13 (see below), will be
# configured, and the Tomcat server will be on the same machine as Apache. In
# case you want load balancing at Tomcat level, this will be the file to modify.
#
# See the workers.properties file for details.
#
JkWorkersFile conf.d/workers.properties
JkLogFile logs/jk.log
JkLogLevel info

#
# This is what we want to handle to Tomcat. The rest is handled by Apache itself
# (Apache knows about KeepAlive, not Tomcat).
#
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13

#
# We want minimal Server headers in HTTP responses.
#
ServerTokens Prod
ServerSignature off

#
# We have no user accounts. Just in case though, we don't want any ~user.
#
UserDir disabled

##
# MAIN VHOST #
##

#
# Our main vhost is SSL. Always.
#
NameVirtualHost 10.142.81.12:443

VirtualHost frontend.kitchen.eel:443

ServerAdmin [EMAIL PROTECTED]
DocumentRoot /var/lib/tomcat5/webapps/one2team
ServerName frontend.kitchen.eel

#
# We want our logs in separate files. We also want a log format that is
# actually useful!
#
ErrorLog logs/one2team-error_log
LogFormat %{%Y%m%d,%H:%M:%S}t %h (%s/%c; %B bytes/%D usecs)
\%r\ one2team
CustomLog logs/one2team-access_log one2team

RedirectMatch permanent .*/favicon\.ico$
https://frontend.kitchen.eel/images/one2team.ico

#
# The SSL part... First, the directives for the SSL engine itself.
#
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:-MEDIUM:-SSLv2:-LOW:-eNULL
SSLOptions +StdEnvVars +ExportCertData

#
# Now the SSL certificate.
#
# IMPORTANT: the default installation provides the server with a
# SELF-SIGNED CERTIFICATE. You may want to put a CA trusted certificate
# instead. In this case, you should also provide a trust chain in
# SSLCertificateChainFile.
#
# See the mod_ssl documentation for details.
#
SSLCertificateKeyFile conf/ssl.key/one2team.key
SSLCertificateFile conf/ssl.crt/one2team.crt

#
# Expiry policy
#
ExpiresActive On
ExpiresDefault access plus 1 hour
AddDefaultCharset UTF-8

#
# Mod deflate: on the server side as well as on the client side...
#
SetOutputFilter DEFLATE
SetInputFilter DEFLATE
DeflateMemLevel 9
DeflateCompressionLevel 3
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
#
# But not for these types of files
#
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|com)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI
\.(?:t?gz|zip|bz2|sit|rar|lha|Z|arc|jar|war)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI
\.(?:pdf|stc|std|sti|stw|sxc|sxd|sxg|sxi|sxm|sxw)$ no-gzip dont-vary

#
# Dynamic content: handle specially
#
Location /jsp
Header append Pragma no-cache
#
# We WANT the JSP content to expire immediately (it's 

Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-12 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francis,

Francis Galiegue wrote:
| Apache is much better at serving static content...

To be fair, Apache httpd and Tomcat are about equal. But, if you are
already using Apache httpd, you may as well have it serve the static
content instead of forwarding such requests to Tomcat.

Sorry to pick nits, but the fallacy that Tomcat sucks as a static
content server just needs to die.

- -chris

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

iEYEARECAAYFAkgA7LkACgkQ9CaO5/Lv0PBK8QCgvoAeRt4TdZQUZtruDvHh9FOf
xLEAn3/IYhjciwmaoeKIRpLxa3d6Zpk5
=IXnt
-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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-12 Thread Francis Galiegue
2008/4/12, Christopher Schultz [EMAIL PROTECTED]:
 -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1

  Francis,

  Francis Galiegue wrote:
  | Apache is much better at serving static content...

  To be fair, Apache httpd and Tomcat are about equal. But, if you are
  already using Apache httpd, you may as well have it serve the static
  content instead of forwarding such requests to Tomcat.

  Sorry to pick nits, but the fallacy that Tomcat sucks as a static
  content server just needs to die.


Well, the performance tests we did (Tomcat 5.0.x/Coyote vs Apache
2.0.x/AJP13/Tomcat 5.0.x) surely didn't account for it being a
fallacy. I don't know whether this has changed in 5.5.x/6.x, but
Coyote doesn't know about mod_expires and keepalive, for one. And that
makes a huge difference.

-- 
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk (solved partly)

2008-04-12 Thread Shashidhar Rampally
My troubles are not yet over! :)

With my configuration, I am having problems with HTTPS pages. I am
getting a 404 error. I get that error even though I replaced
VirtualHost *:80 with VirtualHost *:*

Also when I tried to replace one VirtualHost with multiple
VirtualHosts (and hence not needing mod_rewrite), I am getting the
following error message:
[warn] VirtualHost xyz.com:80 overlaps with VirtualHost
www.xyz.com:80, the first has precedence, perhaps you need a
NameVirtualHost directive

Please help!

Thanks,
Shashi


On Sat, Apr 12, 2008 at 4:55 AM, Francis Galiegue [EMAIL PROTECTED] wrote:
 2008/4/12, Shashidhar Rampally [EMAIL PROTECTED]:
   Francis,
  

   I have followed your suggestion of using a VirtualHost but also made
use of a suggestion I found on a website which talked about putting
mod_rewrite rules inside the VirtualHost element along with the
JkMount command inside. And wow! it works great. :)) Thank you!
  

  No problem :) But see below.


The only thing that's still unsolved is how do I redirect aboutus.html
permanently to aboutus.jsp (and 9 more such pages). I can follow the
same concept and put all those rules inside the VirtualHost, but I was
wondering if that would have performance implications? Is there anyway
I can .htaccess into play?
  
Thanks,
Shashi
  
VirtualHost *:80
   JkMount /* ajp13

  Why /*? Why not only /*.jsp? Apache is much better at serving static 
 content...

  Here is the Apache configuration file I use, from a server at home
  (hence the RFC 1918 address and nonsensical domain name), you'll
  notice that I don't use mod_rewrite at all and that one URL
  (/favicon.ico) is redirected using RedirectMatch. You can use this
  trick for your yet unredirected pages.

  Before the end of the file, you'll see how I manage to redirect
  another server name to the main one, it's dead simple. Again, no
  mod_rewrite needed ;)

   CUT 
  ##
  # TOMCAT #
  ##
  #
  # We use mod_jk for talking with Tomcat. Note that this module does NOT come
  # from RHEL, but from JPackage.
  #
  LoadModule jk_module modules/mod_jk.so

  #
  # The JkWorkersFile is the location (starting from the ServerRoot) of the
  # configuration file for mod_jk.
  #
  # In a traditional One2team setup, only one worker, of type AJP 1.3 and with
  # name ajp13 (see below), will be
  # configured, and the Tomcat server will be on the same machine as Apache. In
  # case you want load balancing at Tomcat level, this will be the file to 
 modify.
  #
  # See the workers.properties file for details.
  #
  JkWorkersFile conf.d/workers.properties
  JkLogFile logs/jk.log
  JkLogLevel info

  #
  # This is what we want to handle to Tomcat. The rest is handled by Apache 
 itself
  # (Apache knows about KeepAlive, not Tomcat).
  #
  JkMount /*.jsp ajp13
  JkMount /servlet/* ajp13

  #
  # We want minimal Server headers in HTTP responses.
  #
  ServerTokens Prod
  ServerSignature off

  #
  # We have no user accounts. Just in case though, we don't want any ~user.
  #
  UserDir disabled

  ##
  # MAIN VHOST #
  ##

  #
  # Our main vhost is SSL. Always.
  #
  NameVirtualHost 10.142.81.12:443

  VirtualHost frontend.kitchen.eel:443

 ServerAdmin [EMAIL PROTECTED]
 DocumentRoot /var/lib/tomcat5/webapps/one2team
 ServerName frontend.kitchen.eel

 #
 # We want our logs in separate files. We also want a log format that 
 is
 # actually useful!
 #
 ErrorLog logs/one2team-error_log
 LogFormat %{%Y%m%d,%H:%M:%S}t %h (%s/%c; %B bytes/%D usecs)
  \%r\ one2team
 CustomLog logs/one2team-access_log one2team

 RedirectMatch permanent .*/favicon\.ico$
  https://frontend.kitchen.eel/images/one2team.ico

 #
 # The SSL part... First, the directives for the SSL engine itself.
 #
 SSLEngine on
 SSLProtocol all -SSLv2
 SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:-MEDIUM:-SSLv2:-LOW:-eNULL
 SSLOptions +StdEnvVars +ExportCertData

 #
 # Now the SSL certificate.
 #
 # IMPORTANT: the default installation provides the server with a
 # SELF-SIGNED CERTIFICATE. You may want to put a CA trusted 
 certificate
 # instead. In this case, you should also provide a trust chain in
 # SSLCertificateChainFile.
 #
 # See the mod_ssl documentation for details.
 #
 SSLCertificateKeyFile conf/ssl.key/one2team.key
 SSLCertificateFile conf/ssl.crt/one2team.crt

 #
 # Expiry policy
 #
 ExpiresActive On
 ExpiresDefault access plus 1 hour
 AddDefaultCharset UTF-8

 #
 # Mod deflate: on the server side as well as on the client side...
 #
 SetOutputFilter DEFLATE
 SetInputFilter DEFLATE
 DeflateMemLevel 9
 DeflateCompressionLevel 3
 

Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Francis Galiegue
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Shashidhar Rampally
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Francis Galiegue
2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:
 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.

Well, I use mod_jk AND vitural hosts. Even though, in most cases, the
hostname of the server is its real FQDN!

mod_jk and VitrtualHosts are NOT incompatible. Meh, I even have my
Host defined as only responding to localhost!

-- 
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Terence M. Bandoian
Hi-

I'd suggest using RewriteLog and RewriteLogLevel to determine exactly
how your RewriteCond and RewriteRule directives are processed.

-Terence M. Bandoian


 Subject:
 301 permanent redirects in Apache + Tomcat using mod_jk
 From:
 Shashidhar Rampally [EMAIL PROTECTED]
 Date:
 Fri, 11 Apr 2008 11:59:04 -0600
 To:
 users@tomcat.apache.org

 To:
 users@tomcat.apache.org

 Message-ID:
 [EMAIL PROTECTED]
 MIME-Version:
 1.0
 Content-Type:
 text/plain; charset=UTF-8
 Content-Transfer-Encoding:
 7bit


 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!

 It looks like one the request is handed over to mod_jk before it gets
 handled by mod_rewrite by Apache. What could I be doing wrong? Please
 advise.

 Thanks,
 Shashi

 My .htaccess file is as follows, which I've placed in
 tomcat/webapps/xyz directory
 Options +FollowSymlinks
 RewriteEngine on
 rewritecond %{http_host} ^xyz.com [nc]
 rewriterule ^(.*)$ http://www.xyz.com/$1 [r=301,nc]

 relevant portion of httpd.conf file...
 LoadModule rewrite_module modules/mod_rewrite.so
 LoadModule jk_module modules/mod_jk.so
 JkWorkersFile /etc/httpd/conf/workers.properties
 JkLogFile /etc/httpd/logs/mod_jk.log
 JkLogLevel error
 JkLogStampFormat [%a %b %d %J:%M:%S %Y]
 JkMount /* ajp13

 Relevant portion of tomcat/conf/server.xml file...
 Host name=xyz.com appBase=webapps unpackWARs=true
 autoDeploy=true xmlValidation=false xmlNamespaceAware=false
 Aliaswww.xyz.com/Alias
 Context path= docBase=xyz
 /Context
 /Host
   


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



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Shashidhar Rampally
Francis,

I placed the following in httpd.conf. However, the next time I visited
xyz.com, it took me to Tomcat home page.
VirtualHost xyz.com:80
DocumentRoot /not/a/valid/folder
ServerName xyz.com
RedirectMatch Permanent /(.*) http://www.xyz.com/$1
/VirtualHost
VirtualHost www.xyz.com:80
DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
ServerName www.xyz.com
/VirtualHost


Your's is not a comprehensive/clean solution. We also moved about 10
links. So I also wish to permanently redirect these HTML pages too.

So what would really help me is a URL rewriting module/plug-in like mod_rewrite.

Thanks,
Shashi


On Fri, Apr 11, 2008 at 1:45 PM, Francis Galiegue [EMAIL PROTECTED] wrote:
 2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:

  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.

  Well, I use mod_jk AND vitural hosts. Even though, in most cases, the
  hostname of the server is its real FQDN!

  mod_jk and VitrtualHosts are NOT incompatible. Meh, I even have my
  Host defined as only responding to localhost!

  --


 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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Francis Galiegue
2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:
 Francis,

  I placed the following in httpd.conf. However, the next time I visited
  xyz.com, it took me to Tomcat home page.
  VirtualHost xyz.com:80
 DocumentRoot /not/a/valid/folder
 ServerName xyz.com

 RedirectMatch Permanent /(.*) http://www.xyz.com/$1

 /VirtualHost
  VirtualHost www.xyz.com:80
 DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
 ServerName www.xyz.com
  /VirtualHost


  Your's is not a comprehensive/clean solution. We also moved about 10
  links. So I also wish to permanently redirect these HTML pages too.

  So what would really help me is a URL rewriting module/plug-in like
 mod_rewrite.


Please clarify. What are these 10 links? Individual files or whole
directories/webapps?

Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?

-- 
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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Shashidhar Rampally
Francis,

Sorry if I offended you.
Those links are
www.xyz.com/specsheets.html - www.xyz.com/specsheet.jsp
www.xyz.com/aboutus.html - www.xyz.com/aboutus.jsp
www.xyz.com/mission/mission.html moved to www.xyz.com/mission.jsp
etc.

No, I do know anything about mod_proxy. I will look into it right away.

Thanks,
Shashi





On Fri, Apr 11, 2008 at 3:28 PM, Francis Galiegue [EMAIL PROTECTED] wrote:
 2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:

  Francis,
  
I placed the following in httpd.conf. However, the next time I visited
xyz.com, it took me to Tomcat home page.
VirtualHost xyz.com:80
   DocumentRoot /not/a/valid/folder
   ServerName xyz.com
  
   RedirectMatch Permanent /(.*) http://www.xyz.com/$1
  
   /VirtualHost
VirtualHost www.xyz.com:80
   DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
   ServerName www.xyz.com
/VirtualHost
  
  
Your's is not a comprehensive/clean solution. We also moved about 10
links. So I also wish to permanently redirect these HTML pages too.
  
So what would really help me is a URL rewriting module/plug-in like
   mod_rewrite.
  

  Please clarify. What are these 10 links? Individual files or whole
  directories/webapps?

  Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?

  --


 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]



Re: 301 permanent redirects in Apache + Tomcat using mod_jk

2008-04-11 Thread Shashidhar Rampally
I am sorry, I meant I do not know anything about mod_proxy.

On Fri, Apr 11, 2008 at 3:53 PM, Shashidhar Rampally
[EMAIL PROTECTED] wrote:
 Francis,

  Sorry if I offended you.
  Those links are
  www.xyz.com/specsheets.html - www.xyz.com/specsheet.jsp
  www.xyz.com/aboutus.html - www.xyz.com/aboutus.jsp
  www.xyz.com/mission/mission.html moved to www.xyz.com/mission.jsp
  etc.

  No, I do know anything about mod_proxy. I will look into it right away.

  Thanks,
  Shashi







  On Fri, Apr 11, 2008 at 3:28 PM, Francis Galiegue [EMAIL PROTECTED] wrote:
   2008/4/11, Shashidhar Rampally [EMAIL PROTECTED]:
  
Francis,

  I placed the following in httpd.conf. However, the next time I visited
  xyz.com, it took me to Tomcat home page.
  VirtualHost xyz.com:80
 DocumentRoot /not/a/valid/folder
 ServerName xyz.com

 RedirectMatch Permanent /(.*) http://www.xyz.com/$1

 /VirtualHost
  VirtualHost www.xyz.com:80
 DocumentRoot /usr/lib/apache-tomcat/webapps/xyz/
 ServerName www.xyz.com
  /VirtualHost


  Your's is not a comprehensive/clean solution. We also moved about 10
  links. So I also wish to permanently redirect these HTML pages too.

  So what would really help me is a URL rewriting module/plug-in like
 mod_rewrite.

  
Please clarify. What are these 10 links? Individual files or whole
directories/webapps?
  
Also, have you considered mod_proxy (ProxyPass and ProxyPassReverse)?
  
--
  
  
   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]