KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Spring MVC (3.0) considers URLs with and without trailing slashes as the same URL. For example: http://www.example.org/data/something = http://www.example.org/data/something/ I need to redirect the URL with trailing slashes http://www.example.org/data/something/ to the URL without it: http://www.example.org/data/something I need to do this internally the application (so not rewrite rules via Apache, etc). A way to do it is: @ResponseStatus(value=HttpStatus.MOVED_PERMANENTLY) @RequestMapping(value = "/data/something/") public String dataSomethingRedirect(...) { return "redirect:/data/something"; } but this has generally 2 problems: too many controllers problem with parameters: like wrong encoding Question Is there a way to intercept all the URLs and in case they have a trailing slash, redirect them to the relative one without slash?
Tags (comma-separated)
Save Edits
Cancel