It's not HTML question, rather a PHP one 🙂
Check $HTTP_REFERER:
<?
if (!preg_match('/www.yourserver.com/i', $HTTP_REFERER))
{
header('Location: [url]http://www.yourserver.com[/url]');
exit;
}
?>
But I think that it's not very nice practice to force your visitors to go to the first page (in case you have no strong need to do it).