0

I have a java web project myapp running on tomcat 8 my html file is in myapp/app/index.html But i dont want the app to be seen in the url - just myapp/index.html How can this be done

yonia
  • 1,681
  • 1
  • 14
  • 12

2 Answers2

0

You can use the rewrite Valve.

myapp/
  app/index.html
  META-INF/context.xml <-- add
  WEB_INF/
    rewrite.config <-- add
    web.xml

context.xml:

<?xml version="1.0" encoding="utf-8"?>
<Context>
    <Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>
</Context>

rewrite.config:

RewriteRule ^/index.html /app/index.html
RewriteRule ^/$ /app/index.html
xiaofeng.li
  • 8,237
  • 2
  • 23
  • 30
0

Or you could run your app in the root context of tomcat:

Community
  • 1
  • 1
Thomas Steinbach
  • 1,019
  • 1
  • 9
  • 19
  • Thomas Steinbach I will still see the subdirectory in the url path – yonia Jan 07 '15 at 13:01
  • The obvious solution to that problem, to copy the web resources to the webapp root folder, is not acceptable I guess? Why are they in an 'app' subfolder? To maintain an easier to manage hierarchy for development perhaps? – Gimby Jan 07 '15 at 13:10
  • Yes exactly that's the idea – yonia Jan 07 '15 at 13:31