This is one of the most common tasks in website development and also one of the most frequently asked question according to some of the keyword research tools. Well, you have 3 ways to achieve a web page redirection.
- Use PHP header() function to modify and send a HTTP Location header:
header("Location: /thankyou.html"); // redirect the visitor to the /thankyou.html page on the same website
header("Location: http://www.microsoft.com"); // redirect the visitor to Microsoft
You will need to make sure there’s no output at all before the calling of the header function to avoid any headers already sent errors.
- Use the meta tag of HTML:
<meta http-equiv="refresh" content="3;url=http://www.example.com/hi.html">
Which will simply refresh the visitor’s browser window and redirect to http://www.example.com/hi.html in 3 seconds.
- Use JavaScript to manipulate the browser window location object:
<body onload="document.location='http://www.example.com/'">
Pingback: HTML: Make a Page Refresh Every xx Seconds