I want my application to route to "/" whenever browser go to any path except "/api".
here's what i did on my redirectIfNotApi() method in my controller.
@Controller
@RequestMapping("/")
class MyController {
@RequestMapping(value = "{^(?!api).$}")
public String redirectIfNotApi() {
System.out.println("Route to VueJS anything except /api");
return "forward:/";
}
}
regex {^(?!api).$} does not work. Everytime i try to go to localhost:8080/, redirectIfNotApi() does not called.
please help. Thank you.