Tuesday, 9 June 2020

redirect method

redirect method
<?php
header('Location: https://www.youtube.com/');
whenever page is openm it will automatically redirects to google page
?>
if it is from own pages, not neccesary to give- http
if we write any html tags before of this php code, not useful
<?php ob_start(); ?>
sometimes redirect not happens , for this purpose we have to use ob_start and ob_end_flush]
<h1> redirtect </h1>
<?php
header('Location: https://www.youtube.com/');
ob_end_flush();
if we use ob_start , have to use ob_flash
?>
with some modificaitons
<?php ob_start(); ?>
<h1> redirtect </h1>
<?php
$rpage = 'http://www.google.com';
$redirect = true;
if it is false , page is not redirect
if($redirect == true) (
false - prints h1
header ('Location: '.$rpage);
)
ob_end_flush();
?>
applications - if login redirect to another page,
if not blocks- redirect to another page

how to redirect to some website or own pages
is it necessary to use obstart
will we use obstart if header shows error 
hwo to redirects 
how to redirect when conditon is true only



header("location:url")
ob_start()
header
ob_end_flush
ob_start()
if
header("location:url")
ob_end_flush

No comments:

Post a Comment