How to redirect URLs with trailing slash to the corresponding ones without it?

前端 未结 7 1569
遥遥无期
遥遥无期 2020-12-05 10:12

Spring MVC (3.0) considers URLs with and without trailing slashes as the same URL.

For example:

http://www.example.org/data/something = http:

相关标签:
7条回答
  • 2020-12-05 11:11

    Not sure if spring 3.0 had this, but spring 3.1 RequestMappingHandlerMapping allows you to set a "useTrailingSlashMatch" property. By default it is true.

    I think switching it to false would solve your issue, however it would affect ALL mappings handled by RequestMappingHandlerMapping across your application... so you may have a fair amount of regression to do.

    0 讨论(0)
提交回复
热议问题