LoginSignup
6
7

More than 5 years have passed since last update.

Play Framework 2.4でURLの末尾スラッシュに対応

Posted at

やりたいこと

http://hogehoge/login
http://hogehoge/login/

上記のパターン両方アクセスしたい。

解決策

上記のリンクの通りやればできた。

ただしplay2.4の場合はactionがstaticではアクセスできないので注意。

GET  /*path/  controllers.Application.untrail(path: String)

java

public Result untrail(String path) {
   return movedPermanently("/" + path);
}

これでスラッシュなしに転送される(301)

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7