Redirect 如何创建从移动站点到桌面站点的重定向?
当用户登陆Redirect 如何创建从移动站点到桌面站点的重定向?,redirect,http-status-code-302,moovweb,tritium,Redirect,Http Status Code 302,Moovweb,Tritium,当用户登陆m.example-site.com/hello时,我想将他们重定向到hello.com/example 在使用Moovweb时,我如何才能最好地实现这一点?(理想情况下,它将提供最快的用户体验。)如果您使用的是stdlib混频器,您可以通过使用氚中的redirect\u temporary或redirect\u permanent功能来实现这一点 redirect\u temporary(Text%url)函数将导致302HTTP重定向响应返回到客户端 redirect\u perm
m.example-site.com/hello
时,我想将他们重定向到hello.com/example
在使用Moovweb时,我如何才能最好地实现这一点?(理想情况下,它将提供最快的用户体验。)如果您使用的是
stdlib
混频器,您可以通过使用氚中的redirect\u temporary
或redirect\u permanent
功能来实现这一点
redirect\u temporary(Text%url)
函数将导致302
HTTP重定向响应返回到客户端
redirect\u permanent(Text%url)
函数将导致301
HTTP重定向响应返回到客户端
为了完成您的具体示例,您可以匹配$path
变量,然后调用您喜欢的重定向函数。以下是永久重定向的示例:
match($path, "/hello") {
redirect_permanent("http://hello.com/example")
}
如果您使用的是
stdlib
混频器,您可以通过使用氚中的redirect\u temporary
或redirect\u permanent
功能来实现这一点
redirect\u temporary(Text%url)
函数将导致302
HTTP重定向响应返回到客户端
redirect\u permanent(Text%url)
函数将导致301
HTTP重定向响应返回到客户端
为了完成您的具体示例,您可以匹配$path
变量,然后调用您喜欢的重定向函数。以下是永久重定向的示例:
match($path, "/hello") {
redirect_permanent("http://hello.com/example")
}
您也可以使用Javascript实现这一点 当用户登陆
m.example-site.com/hello
时,在文档头部添加一个
标记,指定一个新的窗口。位置
所以,它看起来像:
<script>
// similar behavior as an HTTP redirect
window.location.replace("hello.com/example");
</script>
//类似于HTTP重定向的行为
window.location.replace(“hello.com/example”);
您也可以使用Javascript实现这一点
当用户登陆m.example-site.com/hello
时,在文档头部添加一个
标记,指定一个新的窗口。位置
所以,它看起来像:
<script>
// similar behavior as an HTTP redirect
window.location.replace("hello.com/example");
</script>
//类似于HTTP重定向的行为
window.location.replace(“hello.com/example”);