First, you need to have Apache Tomcat installed Installing Apache Tomcat to work in Java
To enable redirection in the server configuration, you need to log into the file:
- C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\context.xml
to these lines, which are already recorded by the developer
We add these lines
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
Then we pass here
C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\WEB-INF
Create a file: rewrite.config
We write down the contents of the file by analogy with the file .htaccess
RewriteRule ^(.*)$ http://mysite.com/ [L,R=301]
Who worked with htaccess, I think, will quickly find similarities and understand.
Perhaps in the future I will make more detailed materials how to manage this file, for those who are not familiar with such control files like "htaccess"
Rating: 5 | Тotal votes: 4 | Please, rate this article
Thanks, This article is good! Reply