Setting a custom root URL in Play 2.0

2019-03-28 05:02发布

问题:

I have a play appliaction that works if It is the root of the web host however I want to load it as a sub-url of my host

That is

http://example.com/ <- This works fine and i want to move to it 
http://example.com/AwesomePlayApplication/  <- This want me to rewrite all the routes 

Is there a way to just set a custom root URL that will translate all my configured routes?

回答1:

Add the following configuration key in your conf/application.conf file:

application.context="/AwesomePlayApplication"


回答2:

As stated by James Roper on google groups : Play 2.0.* does not support running on a different context yet, but Play 2.1 will.