[2.0.x] get rid of the initial html page in the url

35 views
Skip to first unread message

sas

unread,
Oct 14, 2012, 9:05:05 PM10/14/12
to play-fr...@googlegroups.com
http://stackoverflow.com/questions/12888054/play-framework2-get-rid-of-the-inicial-html-page-in-the-url

I have defined the following routes file:

GET     /           controllers.Application.app

# web service entries...
GET     /api/users  controllers.Users.list
[...]

# Map static resources from the /public folder to the /assets URL path
GET     /*file      controllers.Assets.at(path="/public", file)

and in my Application.app action I just redirect to index.html

def app = Action {
  Redirect(routes.Assets.at("index.html"))
}

so when I access to my application at http://mydomain I'm redirected tohttp://mydoamin/index.html, which then add a /#ideas to the location (it's a single web page app)

I'd like to get rid of the index.html file, and instead being redirected to http://mydoamin/#ideas

is it possible?

Julien Richard-Foy

unread,
Oct 15, 2012, 4:04:46 AM10/15/12
to play-fr...@googlegroups.com
Hi,
Instead of doing a redirection just serve the static file:

object Application extends Controller {
def app = Assets.at(path = "public", file = "index.html")
}

Regards,
Julien

sas

unread,
Oct 15, 2012, 12:46:17 PM10/15/12
to play-fr...@googlegroups.com
thanks a lot Julien

I did directly in the routes file

GET     /     controllers.Assets.at(path="/public", file="index.html")
saludos

sas
Reply all
Reply to author
Forward
0 new messages