Search code examples
http-redirecthttp-status-code-302moovwebtritium

How do I create a redirect from mobile to desktop site?


When a user lands on m.example-site.com/hello I would like to redirect them to hello.com/example.

How can I best accomplish this when using Moovweb? (Ideally it'd provide the fastest user experience.)


Solution

  • You can accomplish this using Javascript as well.

    When the user lands on m.example-site.com/hello, add a <script> tag in the head of the document specifying a new window.location.

    So, it'd look like:

    <script>
    // similar behavior as an HTTP redirect
    window.location.replace("hello.com/example");
    </script>