Answers for "location in php header for redirect"

PHP
2

header php redirect

<?php
  header('Location: http://www.aaaa/index.php');
  exit();		// useless to let script running
?>

<?php
  // permanent redirection (default is 302, 303 for most robots)
  header('Location: http://www.aaaa/index.php', true, 301);
  exit();		// useless to let script running
?>

// or a meta in html header (if html generation is initiated) 
<head>
	<meta http-equiv="Location" content="http://www.aaaa/index.php">
</head>
// or waits 15s before redirection
<head>
  	<meta http-equiv="refresh" content="15;URL=http://www.aaaa/index.php">
</head>

// or via javascript
<script>
	window.location.replace('http://www.aaaa/index.php');
</script>
Posted by: Guest on January-23-2021
2

header location in php

<?php
/*
	This will redirect  to facebook.com
*/
$url = "https://facebook.com.com";
header("Location: $url");  
exit;
?>
Posted by: Guest on July-17-2020
8

header location in php

<?php
// This will redirect  to google.com
$url = "https://google.com";
header("Location: $url");  
?>
Posted by: Guest on July-09-2020

Browse Popular Code Answers by Language