Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to rewrite Tomcat URL

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to rewrite Tomcat URL". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Prepare to install JDKyum install java-1.8.0-openjdk-develvim / etc/profile.d/jdk.shexport JAVA_HOME=/usr/java/latest # first define the JAVA_HOME environment variable export PATH=$JAVA_HOME/bin:$PATH # and then append. / etc/profile.d/jdk.sh install tomcatyum install tomcat tomcat-admin-webapps.noarch\ tomcat-webapps.noarch tomcat-docs-webapp.noarchurlRewriteFilter for redirection

UrlRewriteFilter is a Web filter for rewriting URL, similar to Apache's mod_rewrite. Suitable for any Web application server (such as Tomcat,jboss,jetty,Resin,Orion, etc.). Its typical application is to make dynamic URL static to facilitate search engine crawlers to crawl your dynamic web pages.

Download UrlRewriteFilter

UrlRewriteFilter's official website http://tuckey.org/urlrewrite/

The jar package should be placed in the WEB-INF/lib directory of the application

Yum install wget-ycd / usr/share/tomcat/webapps/ROOT/WEB-INF/lib/wget http://central.maven.org/maven2/org/tuckey/urlrewritefilter/4.0.3/urlrewritefilter-4.0.3.jar configuration filtering rules

Create a rule file called urlrewrite.xml under the. / WEB-INF/ directory of the application, and the name must not be wrong!

Vim. / WEB-INF/urlrewrite.xml seo redirect ^ www.example.com ^ localhost ^ /. * http://www.example.com/$1 configuration tomcat

Add to the web.xml in the `. / WEB-INF/ of the application

Vim. / WEB-INF/web.xml UrlRewriteFilter org.tuckey.web.filters.urlrewrite.UrlRewriteFilter UrlRewriteFilter / * REQUEST FORWARD "how to rewrite Tomcat URL" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 287

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report