6
How to redirect pages with PHP, HML, htaccess, and JavaScript
Redirect Via php
{code type=php}<?
header( ‘Location: http://www.FremontTech.com’ ) ;
?>
<html>
<head> </head>
<body> </body>
</html>{/code}
Redirect Via html
{code type=html}<html>
<head>
<meta http-equiv=”refresh” content=”5; url=http://www.FremontTech.com/”>
</head>
<body></body>
</html>{/code}
Redirect Via htaccess
{code type=html}#FremontTech.com Redirect Specific Pages
Redirect /Old.htm /New.htm{/code}
{code type=html}#FremontTech.com Redirect Specific Pages
Redirect /Old.htm http://www.yoursite.com/New.htm{/code}
Old.htm is requested give them New.htmRedirect Via JavaScript
{code type=html}<html>
<head>
<script type=”text/javascript”>
<!–
window.location = “http://www.FremontTech.com/”
//–>
</script>
</head>
<body></body>
</html>{/code}
Redirect Via JavaScript with delay
{code type=html}<html>
<head>
<script type=”text/javascript”>
<!– function delayer(){
window.location = “http://www.FremontTech.com”
}
//–>
</script>
</head>
<body onLoad=”setTimeout(‘delayer()’, 5000)”>
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new location!</p>
</body>
</html>
{/code}
The most important part of getting the delay to work is being sure to use the JavaScript function setTimeout. We want the delayer() function to be used after 5 seconds or 5000 milliseconds (5 seconds), so we pass the setTimeout() two arguments.
- ‘delayer()’ – The function we want setTimeout() to execute after the specified delay.
- 5000 – the number of millisecods we want setTimeout() to wait before executing our function. 1000 miliseconds = 1 second.







Twitter
Subscribe
Follow US