본문 바로가기

WEB-SERVER/OHS & JBCS & Apache

[Apache] url 별 redirect 페이지 만들기

728x90

 

소스 하나에 세 개의 domain 요소가 있다면,

다음과 같이 해주면 된다.

 

[index.html]

<html>

        <head>

                <title>RARARARARARA</title>
        <script>

                var nowURL = window.location.href;

                if(nowURL.includes("a.com"))
                {
                        window.location.href="http://a.com/test/main1.do";
                        console.log(nowURL)
                }
                else if(nowURL.includes("b.com"))
                {
                        window.location.href="http://b.com/test/main2.do";
                        console.log(nowURL)
                }
                else if(nowURL.includes("c.com"))
                {
                        window.location.href="http://c.com/test/main3.do";
                        console.log(nowURL)
                }

        </script>

        </head>

        <body>

                <h1></h1>

        </body>

</html>