Explanation of the error
There are some syntax errors in this route configuration:
GET /masterid controller.Assets.at("/app/www/",index.html)
It should be controllers
instead of controller, the path is wrong, and the parameters are not specified correctly. It could be written as:
GET /masterid controllers.Assets.at(path="/app/www", file="index.html")
Note that as written, this route will map only to the index.html
file, not to any other resources under /masterid
.
Solution with a separate directory
To behave exactly as asked, with a separate directory and a custom URL, you would need to specity a second asset route in addition to the default one. This would also require changing all usages of @routes.Assets.at
to specify two parameters (folder
and file
), and adding a configuration to build.sbt
:
playAssetsDirectories <+= baseDirectory / "app/www"
Solution using the public directory and a custom URL
The path of least resistance is to create the custom index.html
file in the project's public
directory. To use a custom URL as asked in the question, you could change the default asset path to "masterid" by changing this line in the routes
file:
GET /assets/*file controllers.Assets.at(path="/public", file)
to this:
GET /masterid/*file controllers.Assets.at(path="/public", file)
In this case the custom index.html
file could be accessed as:
http://localhost:9000/masterid/index.html
Relative URLs to other resources under the /public
folder would work as well.
Solution using the public directory and the default URL
If you don't require the /masterid
URL under the root, you can save your index.html
file under public/app
and refer to it as:
@routes.Assets.at("app/index.html")
This will resolve to:
http://localhost:9000/assets/app/index.html
Documentation
For more extensive instructions see Working with public assets.