-
-
Save jcamp/f950b5f6a1007bcd57e44c97047d9707 to your computer and use it in GitHub Desktop.
Checking for page referer in php. Wordpress redirect or header refresh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//check for refering page to switch content based on referrer | |
$referrer = $_SERVER['HTTP_REFERER']; | |
if ($referrer == 'http://url.com' or $referrer == 'http://url-2.com') { | |
//Matches YES! | |
} else { | |
//Matches NO! | |
header( 'Location: http://www.url.com/no-soup-for-you/' ) ; | |
} ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment