header( ‘Location: http://www.yourdomain.com/new_page.html’ ) ;
This function must be called before any actual output is sent unless you will get the following error:
Warning: Cannot modify header information – headers already sent by
Or you can use ob_start() and ob_flush() function to avoid this problem by buffering the output.
ob_start();
echo “Test”;
header( ‘Location: http://www.yourdomain.com/new_page.html’ ) ;
ob_flush();
Using JavaScript
<script type="text/javascript"> window.location = "http://www.google.com/" </script>
No comments:
Post a Comment