0

I am using Apache and Tomcat on a CentOS box and I want to do the following rewrites:

  1. I want to handle abc.com to redirect to www.abc.com when a request is made.
  2. I want to load my resources with Apache instead of Tomcat

This is my conf file. It is located in /etc/httpd/conf.d/tomcat.conf

#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#

RewriteEngine on
RewriteRule ^/images/(.*)    /images/$1
RewriteRule ^/css/(.*)    /css/$1
RewriteRule ^/js/(.*)    /js/$1

RewriteCond %{HTTP_HOST} ^abc\.com
RewriteRule ^(.*)$ http://www.abc.com$1 [R=301,L]

NameVirtualHost *:80
<VirtualHost *:80>
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / ajp://127.0.0.1:8009/
    ProxyPassReverse / ajp://127.0.0.1:8009/
    ProxyPassReverseCookiePath / /
</VirtualHost>

My AJP proxy rewrite is working, I just need to do the following rewrites above.

Jonathan Airey
  • 416
  • 1
  • 5
  • 17

1 Answers1

0
  1. apache redirect from non www to www
  2. To load your resources with apache instead of tomcat, you can:
    • use apache mod_cache module, so you can decrease your tomcat load dramatically by caching your resources (css, js, images)
    • add servlet filters in your web application to set http cache headers in order to enable caching
Community
  • 1
  • 1
Moam
  • 176
  • 2
  • 16