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.)
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.)
If you're using the stdlib
mixer, you can accomplish this by using the redirect_temporary
or redirect_permanent
functions in tritium.
The redirect_temporary(Text %url)
function will cause a 302
HTTP redirect response to be returned to the client.
The redirect_permanent(Text %url)
function will cause a 301
HTTP redirect response to be returned to the client.
To accomplish your specific example, you could match on the $path
variable and then call whichever redirect function you'd prefer. Here's an example for a permanent redirect:
match($path, "/hello") {
redirect_permanent("http://hello.com/example")
}
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 newwindow.location
.So, it'd look like: