PHP jumps according to Referer:
The code is as follows |
Copy Code |
<?php $ref = $_server[' Http_referer ']; if (Stripos ($ref, "Baidu") | | stripos ($REF, "Google") { Header ("Location:http://www.111cn.net"); Exit } ?> |
Jump according to UA:
The code is as follows |
Copy Code |
<?php $userAgent = $_server[' http_user_agent ']; if (Stripos ($userAgent, "Moz") | | stripos ($userAgent, "Baidu")) { Header ("Location:http://www.111cn.net"); } ?> |
The header () function is defined as follows:
void header (String string [, bool replace [, int http_response_code]])
Optional parameter replace indicates whether to replace the previous similar header or to add a header of the same type, which defaults to replace.
The Second optional parameter Http_response_code forces the HTTP corresponding code to the specified value. The header of the location type in the header function is a special header invocation that is commonly used to implement page jumps. Note: 1.location and ":" No space between, otherwise will not jump.
JS Judgment method:
The code is as follows |
Copy Code |
<script> var s=document.referrer; if (S.indexof ("Baidu") >0| | S.indexof ("Soso") >0| | S.indexof ("Google") >0| | S.indexof ("yahoo") >0| | S.indexof ("Sogou") >0| | S.indexof ("Youdao") >0| | S.indexof ("Bing") >0) { Self.location= "Http://www.111cn.net"; } </script> |