Smart IT / MyIT - how to redirect to MyIT or Smart IT based on URL used to connect to MyIT/SmartIT Tomcat

Version 2
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Remedy with Smart IT


    APPLIES TO:

    Any MyIT/Smart IT version



    QUESTION:

    Customer has configured their name resolution so that they can connect to Smart IT or MyIT using the following URLs:-

    https://smartit-dev.mycompany.com/ux/smart-it  ----> opens Smart IT
    https://myit-dev.mycompany.com/ux/myitapp     ----> opens MyIT

    If we ping myit-dev.mycompany.com and smartit-dev.mycompany.com, they both resolve to the same IP Address.

    Now, customer wants to no longer supply the /ux/smart-it or /ux/myitapp paths in their URLs - they require the following to work:-

    https://smartit-dev.mycompany.com     ---------> opens Smart IT
    https://myit-dev.mycompany.com         ---------> opens MyIT

     


    ANSWER:

    The following allows us to redirect to Smart IT or MyIT based on the URL (with no path) provided:-

    1). Stop the SmartIT/MyIT Tomcat
    2). Create a directory called ROOT under the <SmartIT/MyIT_Install_Dir>\webapps directory
    3). Create an 'index.html' file in this directory with the following contents:-

    <!DOCTYPE html>
    <html lang="en">
            <head>
                    <title>Redirecting...</title>
           </head>
            <body>
                    <script>
                       if (document.URL == "https://myit-dev.mycompany.com/") {
                              location.href = "https://myit-dev.mycompany.com/ux/myitapp";
                       }else if (document.URL == "https://smartit-dev.mycompany.com/") {
                              location.href = "https://smartit-dev.mycompany.com/ux/smart-it";
                       }else{
                                                    document.write("<p> Invalid URL: " + document.URL + "</p>");
                       }
                    </script>
            </body>
    </html>

    4). Restart the SmartIT/MyIT Tomcat

    NOTE: The default port when using HTTPS will be 443. This was the 'Connector port' value in the SmartIT/MyIT Tomcat 'server.xml' file in this case. This is why the customer did not have to specify a port number in their URLs.
    If a customer was using HTTP rather than HTTPS then the 'Connector port' in SmartIT/MyIT Tomcat 'server.xml' would need to be port 80.

    Also, customers may wish to do something different if the URL does not match the expected one for Smart IT or MyIT in the 'else' section above. This could be a redirection to another URL, some home page etc.
     


    Article Number:

    000123497


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles