menu


Subscribe to the blog

Social networks

My page on vk.com
My page on Facebook
My page on Google plus
My page on Twitter

Main - Blog - Redirect to Apache Tomcat - htaccess

Programming Date of creation: Views: 347

Redirect to Apache Tomcat - htaccess

lesnih.info


Russia

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

<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

We add these lines

<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
<WatchedResource>WEB-INF/rewrite.config</WatchedResource>
Save
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
for example:

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"
Redirect to Apache Tomcat - htaccess
Rating: 5 | Тotal votes: 4 | Please, rate this article




Commets:

  • Anton 2018-09-14 18:58:06
    Thanks, This article is good! Reply











    Subscribe to the blog


    Random articles from the blog:


    Java XML - XML record in a java application

    Java XML - XML record in a java application
    Topic: Programming

    Tags: java,xml,write xml,integration,exchange

    Views:1261

    Mysql Java - UPDATE - update data in Mysql

    Mysql Java - UPDATE - update data in Mysql
    Topic: Programming

    Tags: java,mysql,update

    Views:213

    http request and read the html page Java

    http request and read the html page Java
    Topic: Programming

    Tags: java,http,html read

    Views:131