[英]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.