java – 使用Play映射特定的文件路由!骨架

我想在我的Play上设置Google网站管理员!网站通过HTML页面.
谷歌游戏我一个特定的HTML页面,他们问我放在mydomain.com/someuniquehash.html.

我把文件放在我的应用程序的public / html文件夹中,我尝试将此规则添加到Play!的路径文件中:

GET /someuniqhehash.html staticDir:public / html / someuniquehash.html

然而,当我访问此URL时,我得到404:

These routes have been tried, in this order :

GET       /@documentation/cheatsheet/{category}             PlayDocumentation.cheatSheet
GET       /@documentation/modules/{module}/files/{name}     PlayDocumentation.file
GET       /@documentation/modules/{module}/images/{name}    PlayDocumentation.image
GET       /@documentation/modules/{module}/{id}             PlayDocumentation.page
GET       /@documentation/files/{name}                      PlayDocumentation.file
GET       /@documentation/images/{name}                     PlayDocumentation.image
GET       /@documentation/{id}                              PlayDocumentation.page
GET       /@documentation/?                                 PlayDocumentation.index
GET       /                                                 Application.index
GET       /someuniquehash.html/                     staticDir:public/html/someuniquehash.html
GET       /favicon.ico                                      404
GET       /public/                                          staticDir:public
GET       /{action}                                         Application.{action}
*         /{controller}/{action}                            {controller}.{action}

如何为此特定静态文件配置路由?

解决方法:

您需要使用staticFile,而不是staticDir.

因此你的路线应该是

GET     /someuniquehash.html         staticFile:/public/html/someuniquehash.html
上一篇:Page 404 CodeIgniter index.php


下一篇:16、不同路由传值