-
-
Save dgoze/cee8f8cfed08db312a9764af96f0c736 to your computer and use it in GitHub Desktop.
Checking for page referer in php. Wordpress redirect or header refresh
This file contains hidden or 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