采纳.html结尾的页面,更加容易被搜索引擎收录,进步网站的曝光率.
案例:
心愿通过*/index.html 拜访的是index.jsp而不是真的index.html
那就须要拦挡以 .html 结尾的url 跳转到index.jsp
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration //等同于web.xml配置文件
public class MvcConfigurer implements WebMvcConfigurer{
//开启匹配后缀型配置
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
//开启匹配后缀型配置 .html configurer.setUseSuffixPatternMatch(true);
}
}
发表回复