본문 바로가기

프로그래밍/spring

[spring] 검색엔진에 등록되기 위한 robots.txt 파일 적용하기

1. robots.txt 파일 생성

모든 검색엔진에 적용 되는 코드 입니다. (예외처리나 허용 되지 않도록 하는건 다음 포스팅에 추가하도록 하겠습니다.)

1
2
3
User-agent: *
 
Allow: /
cs


2. 프로젝트에 추가

스프링 프로젝트의 root 디렉토리에 파일을 추가 해준다.


3. resources mapping 작성된 context.xml 수정

1
2
3
<beans:bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
    
<resources mapping="/robots.txt" location="/robots.txt" order="0"/>
cs