Redirect Web Page

Contents

  1. HTTP meta Tag
  2. JSP
  3. PHP
 

HTTP meta Tag

<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">
</head>
</html>

JSP

<html>
<head>
<title>Redirect Page</title>
</head>
<body>
<%
   // New location to be redirected
   String site = new String("http://www.yourdomain.com/index.html");
   response.setStatus(response.SC_MOVED_TEMPORARILY);
   response.setHeader("Location", site);
%>
</body>
</html>

PHP

<?php
header('location: http://url/f.html');
exit();
?>

or:

<?php
echo "<script>document.location.href='news.php'</script>";
?>
This entry was posted in html, php. Bookmark the permalink.