douhuan1905 2015-04-03 13:32
浏览 44

PHP - 引用重定向脚本

I have a tracking link (poly.wtf) . I'm trying to make a php page that check the referred if and to make this condition if the visitor came from my tracking link (poly.wtf) it will redirect him to page X

if the visitor didn't come from my tracking link (anywhere else) or just type the url through the browser it will redirect him to page Y

I'm tried to use this script PHP :

<?php

    $domain = 'poly.wtf';

    $referrer = $_SERVER['HTTP_REFERER'];

     if (preg_match($domain ,$referrer)) {

        header('Location: https://www.google.com/');

     } else {

        header('Location: https://www.yahoo.com/');

    };

?> 

but it doesn't work because for some reason it doesn't capture for me the refer here is example of redirect from poly.wtf link to the PHP page : http://poly.wtf/5d9e31ce-bd7d-4500-bc4e-b7e7f7ddcacc

^^ in this case it should redirect me to google but it doesn't , what do you think is the problem?

  • 写回答

1条回答 默认 最新

  • drtoclr046994545 2015-04-03 14:34
    关注

    You shoul enclose your pattern in some delimiter like:

    $domain = '/poly.wtf/';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线