I have Tomcat and Apache installed in CentOS 5. They're integrated with a help of mod_jk.so.

They both display the same in http://www.tource.com/cms/admin and http://www.tource.com:8080/cms/admin

But I'd like to make the context cms displayed only when I access with address below. http://cms.tource.com/

How could the context "www.tource.com/cms" turn into "cms.tource.com" ?


Do you have an apache config for this site? If so, please post it so we can get a better idea of how you have your site set up.

Here is one way to do it (with mod_proxy and mod_rewrite):


<VirtualHost *>
        ServerName cms.tource.com
        RewriteEngine On
        ProxyPass / http://tource.com:8080/cms/admin
        ProxyPassReverse / http://tource.com:8080/cms/admin

Proxy setting in Tomcat $TOMCAT_HOME/conf/server.xml

<Connector port="8080" protocol="HTTP/1.1"
               redirectPort="8443" proxyPort="80" />

Restart apache and visit cms.tource.com to see if its working for you.


In the web server config of www.tource.com add the following line:

Redirect /cms http://cms.tource.com

For more information , refer to apache documentation at http://httpd.apache.org/docs/2.2/mod/mod_alias.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.