我无法在Spring-MVC中访问Robots.txt
问题内容:
我试图robots.txt
在Spring-
MVC中提供访问权限。为了测试代码,我把robots.txt
在WebContent
,Root
和WEB-INF
,但我不能访问任何人。
我已经应用了这些问题的答案1,2,3无济于事。
我的密码
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:resources mapping="/robots.txt" location="/robots.txt" order="0" />
<mvc:annotation-driven />
问题答案:
这对我有用:
把robots.txt
直属webapp
在mvc-dispatcher-servlet.xml
有:
<mvc:default-servlet-handler/>
<mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/web- resources/" />
使用Maven建立战争