Apache Tomcat : Setting redirection to a single domain for registered domain names

We have a webapp deployed on Apache tomcat server. Currently, what I am doing is creating a ROOT.war and pasting it inside webapps folder. So whenever the domain is called, the webapp is loaded.

Now the first domain name that we have is https://www.helloworld.com. As domain names hello-world.com and hello.world.com were available for cheap, the company already got it. I have set the redirection in the manner as mentioned below in server.xml.

What I would like to be sure of is the redirection below makes sure that Google sees that all these 3 domains are owned by us and detects no content duplication(Not good for SEO) and how can I make sure that whenever someone puts in URL hello-world.com, the user is redirected to helloworld.com. Currently, the URL remains the same, but the webapp loads properly.

Server.xml :

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->

    <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>

<Host appbase="webapps" name="helloworld.com" autoDeploy="true" unpackWARs="true"></Host>
<Host appbase="webapps" name="hello-world.com" autoDeploy="true" unpackWARs="true"></Host>
<Host appbase="webapps" name="hello.world.com" autoDeploy="true" unpackWARs="true"></Host>

If there is any doubt, kindly let me know. Thanks a lot.


Source: apache

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.