springboot实现301跳转 Published on Dec 11, 2023 in 随笔 with 0 comment ```java @GetMapping(value = {"", "/"}) public void toIndex(HttpServletRequest request, HttpServletResponse response, Model model) throws IOException { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", Constants.url + "/en"); // response.sendRedirect("/en"); } ``` 本文由 admin 创作,采用 知识共享署名4.0 国际许可协议进行许可。本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。