0

I want any user trying to access http://localhost:8080/test/ to be redirected to http://localhost:8080/test. I want to remove the extra '/' after test.

I tried writing this in rewrite rules but it doesn't work for me.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • 2
    Hi -- could you post the rules you have tried, even if they don't work. Someone might spot something. –  May 28 '20 at 14:15

1 Answers1

0

If your contextPath is /test then the extra slash is required to satisfy the context path rules of both the servlet spec and the URI / http resource declarations of the various RFCs.

If you set your web application, handler, context, etc with the "context path" of /test then you'll want to switch to using / (the root context) and having a servlet url-pattern of /test (exactly named /test).

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136