if (!empty($_GET['has_javascript']))
$_SESSION['has_javascript'] = $_GET['has_javascript'] == 'yes';
if (!isset($_SESSION['has_javascript'])) {
echo 'Detecting, please wait';
echo '<script type="text/javascript">window.location.href = window.location.href + "?has_javascript=yes";</script>';
echo '<meta http-equiv="refresh" content="5;url=http://www.youromain.tld/?has_javascript=no" />';
}
something like this might do