How to use your webapp instead of ROOT or /folder in URL

If you have a webapp that you have uploaded to the webapps directory in Tomcat and you wish to have your Tomcat hosting use that webapp with your domain instead of ROOT then all you need to do is uncomment and update a context in your tomcat/conf/server.xml file.

Open the file and scroll to the bottom until you see the following:

At the bottom of your server.xml is a commented out context.

<!--
<Context path="/" debug="0" privileged="true"
docBase="/home/{username}/{yourdomain.com}/tomcat/webapps/{WEBAPPNAME}">
</Context>
-->

Remove the comments before and after and change WEBAPPNAME to the exact name of your webapp folder.

Then restart your Tomcat container. Once done, yourdomain.com in the url will load your webapp.

If your server.xml does not contain the above code, simply copy and paste and replace username, domain and webappname with yours in a new line after the <Alias>www.yourdomain.com</Alias>.

  • 247 Users Found This Useful
Was this answer helpful?

Related Articles

Spring Framework

Need to develop Plain Old JAVA Objects? Want to have fun developing your application? Then we...

Subdomain Handling Tutorial

This tutorial explains how you can host subdomains with JavaPipe's Tomcat hosting. This is...

Pointer Domain Handling Tutorial

This tutorial explains how you can host pointer domains with a Java web hosting package from...

Choosing between JBoss7's Standalone or Domain features.

JBoss 7 introduced new feature called managed domains. Basically this is a multi-server...

How do I restart my tomcat?

However, if you have a private Tomcat instance with a Java host like us, then you have the...