Step 1: first download it here
Http://tuckey.org/urlrewrite/Stable: urlrewrite-2.6.0.jar
Step 2: place the urlrewrite-2.6.0.jar under the lib directory of Tomcat.
Step 3: place the urlrewrite-2.6.0.jar in the Web-INF/lib folder under the netbeans project directory.
Put urlrewrite. XML in the Web-INF folder.
WEB-INF
-Lib
Urlrewrite-2.6.0.jar
-Urlrewrite. xml
Step 4: Modify the Web. xml file in the Web-INF folder before <servlet-mapping>.
- <Filter>
- <Filter-Name> urlrewritefilter </filter-Name>
- <Filter-class> org. Tuckey. Web. Filters. urlrewrite. urlrewritefilter </filter-class>
- <Init-param>
- <Param-Name> loglevel </param-Name>
- <Param-value> debug </param-value>
- </Init-param>
- </Filter>
- <Filter-mapping>
- <Filter-Name> urlrewritefilter </filter-Name>
- <URL-pattern>/* </url-pattern>
- </Filter-mapping>
Step 5:
ModifyUrlrewrite. xml: Add a rule to the urlrewrite node as follows:
<Rule>
<From>/home </from>
<To type = "Forward">/index. jsp </to>
</Rule>
Restart tomcat, re-compile the project, deploy and run it. OK.