How to identify the source of access in HTML and jump to different pages.

such as:

what if the source 1.m87.cn jumps to 2.m87.cn
if the source jx.mh87.cn jumps to jx.mh87.cn/vip
?

for example, when the caohangyuan.com spider engine comes, there must be a source, so this source is not operated when it belongs to the spider. Just give it what I want to show him. If the user does not show the content to the user, jump directly to the new page.

Jun.22,2022

if it is PHP, you can use $_ SERVER ['HTTP_REFERER'] to determine the source. If it is JavaScript, you can use document.referrer to determine the source.


take the unfinished answer from the one above, and jump to
php:

$url = "www.baidu.com";
header("Location:{$url}");

html itself cannot identify the access source. You can use js or php to redirect


var ref = document.referrer;
if(ref === ''){ location.href= ... }
.
Menu