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: 383

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:


    Arithmetic Operators in Java

    Arithmetic Operators in Java
    Topic: Programming

    Tags: java

    Views:631

    Java - TXT Read and write a text document

    Java - TXT Read and write a text document
    Topic: Programming

    Tags: java,txt,write txt,read txt,integration,exchange

    Views:297

    Mysql Java - SELECT data from Mysql - Java

    Mysql Java - SELECT data from Mysql - Java
    Topic: Programming

    Tags: java,mysql,select

    Views:247