Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mariussoutier/play-trailing-slash
Automatically 401 redirect routes with a trailing slash to a route without a trailing slash
https://github.com/mariussoutier/play-trailing-slash
Last synced: about 6 hours ago
JSON representation
Automatically 401 redirect routes with a trailing slash to a route without a trailing slash
- Host: GitHub
- URL: https://github.com/mariussoutier/play-trailing-slash
- Owner: mariussoutier
- Created: 2013-03-28T09:34:27.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-03-28T09:53:45.000Z (over 11 years ago)
- Last Synced: 2024-04-16T10:21:19.614Z (7 months ago)
- Language: Scala
- Size: 134 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Play Trailing Slash
===================What is this?
-------------This is a Play Framework 2 module that generates a 401 Moved Permanently redirect for request
paths that end with a slash, redirecting to a path without a trailing slash.Why is this useful?
-------------------Consider a simple URL such as http://www.example.com/login that displays a login page. If the user
enters http://www.example.com/login/ by accident, Play will generate a 404 result. If you define both
routes, Google will treat this as duplicate content. Play's default router only offers a 302 redirect
which doesn't solve the duplicate content problem.How do you use it?
------------------Build.scala:
val trailingSlash = RootProject(uri("git://github.com/mariussoutier/play-trailing-slash.git"))
val main = play.Project(...).dependsOn(trailingSlash)Scala:
import com.mariussoutier.play._
object Global extends GlobalSettings with TrailingSlashJava:
import com.mariussoutier.play.*;
public class Global extends TrailingSlashSettings {
}