바람둥이를 사용하여, 어떻게에 대한 요청을받을 수 있나요 http://www.mydomain.com 로 리디렉션 http://www.mydomain.com/somethingelse/index.jsp를 ? 나는 http://mydomain.com 에서 표시 할 index.html을 얻지 못했습니다 .
바람둥이를 사용하여, 어떻게에 대한 요청을받을 수 있나요 http://www.mydomain.com 로 리디렉션 http://www.mydomain.com/somethingelse/index.jsp를 ? 나는 http://mydomain.com 에서 표시 할 index.html을 얻지 못했습니다 .
답변:
웹앱 WAR의 이름을 "ROOT.war"로 지정하거나 "ROOT"폴더를 포함합니다.
다음을 수행 할 수 있습니다. Tomcat 설치가 기본값이고 변경을 수행하지 않은 경우 기본 전쟁은 ROOT.war. 따라서를 호출 할 때마다 기본 WAR 파일 http://yourserver.example.com/의 index.html또는 index.jsp을 호출 합니다. webapp/ROOT요청을로 리디렉션하려면 폴더 에서 다음과 같이 변경하십시오 http://yourserver.example.com/somewhere/else.
열기 webapp/ROOT/WEB-INF/web.xml, 경로 어떤 서블릿 매핑을 제거 /index.html하거나 /index.jsp, 저장.
있는 webapp/ROOT/index.html경우 제거하십시오 .
다음 내용으로 파일 webapp/ROOT/index.jsp을 만듭니다 .
<% response.sendRedirect("/some/where"); %>
또는 다른 서버로 연결하려는 경우
<% response.sendRedirect("http://otherserver.example.com/some/where"); %>
그게 다야.
본질적으로 Apache의 mod_rewrite의 Java 기반 구현 인 UrlRewriteFilter 를 살펴보십시오 .
ROOTTomcat 폴더 아래의 폴더에 압축을 풀어야 webapps합니다. 그런 다음 WEB-INF/urlrewrite.xml구성 파일 내의 다른 컨텍스트에 대한 리디렉션을 구성 할 수 있습니다 .
제가 한:
ROOT / index.jsp 안에 다음 줄을 추가했습니다.
<meta http-equiv="refresh" content="0;url=/somethingelse/index.jsp"/>
<% response.sendRedirect("/some/where"); %>이제 HTTPS로 전환하여 작동합니다.
Tomcat 8에서는 rewrite-valve를 사용할 수도 있습니다.
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/(.*)$ /somethingelse/index.jsp
재 작성 밸브를 설정하려면 여기를 참조하십시오.
http://tonyjunkes.com/blog/a-brief-look-at-the-rewrite-valve-in-tomcat-8/