Is it possible to redirect the url using spring

I am working on a project using spring, MVC and implementing a webapp-runner. The project used a hierarchy of type /test/home/index.jsp, but using webapp-runner it was changed to /home/index.jsp. So, I need to maintain and redirect the old URL /test/home/index.jsp to /home/index.jsp so that the page does not block if the old URL is used. I will be grateful if anyone can give me a hand.

+8
spring spring-mvc url-rewriting
source share
2 answers
return "redirect:/home/index.jsp"; 

in your controller that returns the name of the view, or create a second controller with the desired mapping.

+2
source share

I would decide that Apache2 on the web application server redirects old traffic to the new URL structure.

Installing it on the server is as simple as starting it

 apt-get install apache2 

Whether I will use rewriting or redirection depends on whether you want to keep the old URLs or not.
See here for more information: http://httpd.apache.org/docs/2.4/rewrite/remapping.html

0
source share

All Articles