[英]Redirect all visitors based on url parameter
我想根据url中的参数重定向用户?
https://example.com/redirect_handler?param=foo&url=http//currentuserwebsite.com
https://example.com/redirect_handler?param=foo&url=,因此用户将首先被重定向到exmple.com,并且基于url param,用户将被重定向到url param(到用户admin)。
有可能吗?
这是您应该尝试的示例:
所以说链接是https://example.com/redirect_handler?param=foo&url=http//currentuserwebsite.com
您需要执行的操作如下:在php文件的顶部,编写以下代码:
<?php
if(isset($_GET['url'])){ //check if the URL parameter is there
$url = $_GET['url']; //declare $url as the parm
Header('Location:'.$url); //note if you are using WordPress use wp_redirect Function
} //end if
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.