You can limit the REFERER to the source page (like the video view page).
# video.php
<?php
if($_SERVER['HTTP_REFERER']!=="https://video.com/watch"){
echo "Forbidden";
exit();
}
In the case where it doesn't matter you can also just check if the HTTP_REFERER header is set, otherwise fail.
# video.php
if(!$_SERVER['HTTP_REFERER']){
echo "Forbidden";
exit();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…