TOMCAT HTACCESS REDIRECT
http://waoewaoe.wordpress.com/2009/06/23/rewrite-url-for-webapp-similar-to-htaccess/
Xampp에서 Ttomcat 서버의 위치
C:\STORAGE\xampp\tomcat\webapps\ROOT
Webapp doesn’t seem to support htaccess file. Therefore, url rewrite can be done by using UrlRewriteFilter. It can be downloaded from: http://tuckey.org/urlrewrite/
This package is very easy to install:
- 1. Download the package
- 2. Put the library in to lib folder under WEB-INF or add as dependencies through maven
- 3. Put the filter to web.xml in WEB-INF
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
4. Copy and Edit urlrewrite.xml to create the rule.
I used this UrlRewriteFilter to take the trailing slashes off the url
For example:
From http://abc.def/ghi/jkl
To http://abc.def/ghi/jkl
What I did was:
1. Tell UrlRewrite to use context path
<urlrewrite use-context=”true”>
2. Add this rule
<rule>
<from>^(.+)/(.+)/$</from>
<to type=”redirect”>$1/$2</to>
</rule>
This may not be a perfect solution but it works :)
참고 :
http://www.linuxquestions.org/questions/linux-server-73/tomcat-url-redirect-4175461611-print/
http://stackoverflow.com/questions/19761841/url-redirect-in-tomcat-project
http://stackoverflow.com/questions/8476613/adding-www-to-url-with-htaccess
'컴퓨터와 인터넷' 카테고리의 다른 글
사용권한을 부여받아야 합니다. 해결방법! (0) | 2015.02.22 |
---|---|
프록시 서버 에 연결할 수 없습니다. 라고 나올때 해결법! (0) | 2015.02.18 |
리눅스 고스트 취약점 QID123191 확인 및 패치 방법 (0) | 2015.01.29 |
메인보드 H61M-HVGS 드라이버 다운로드 (0) | 2015.01.26 |
도쿠위키(Dokuwiki) 플러그인 Tag & Pagelist (0) | 2014.10.29 |