Default page for root path

2019-06-25 08:06发布

问题:

I have the following site structure:

mysite.com

  • /app1/
  • /app2/

Right now with my configuration it seems when I navigate to mysite.com, it shows a list of the apps on the server.

How can I get it to show app1/index.html when i navigate mysite.com?

回答1:

Ok... not sure why it took me this long to find the answer but... according to some page online which I now forget...

Rename app1 folder to 'root'. The default handler defined in your jettyweb config xml will then map this app to /

You can also throw in a WEB-INF folder and web.xml to define things like the default welcome page, so you don't have to type mysite.com/index.html



回答2:

That's right. You can configure one of your webapps to map to "/" by defining a context for it.

Here's the documentation:

  • jetty9 - http://www.eclipse.org/jetty/documentation/current/setting-context-path-to-root.html
  • jetty7/8 - http://wiki.eclipse.org/Jetty/Howto/SetContextPathto_/

If you simply want to disable that list of webapps mapping on the root context "/", then have a look at jetty_home/etc/webdefault.xml and the according sections in the documentation.

Hope that helps.



标签: Jetty