if(condition){ echo '<script>'; echo 'window.location="redirect.php"'; echo '</script>'; }
echo '<script>'; echo 'window.location="index.php"'; echo '</script>';