Login






Lost Password?
No account yet? Register

Advertisement
How do I Automatically Redirect to Another Webpage
Print 
PDF 

Sometimes you may want to move the user away from a directory listing or another web page. There are a few ways to do this, but the quickest and most popular are as follows.

 

PHP Header Redirect: Insert the following code into the top of a .php page to tell the browser to instantly redirect to the page specified. Change the URL as appropriate. To view an example click here.


‹?php

// This will instantly redirect to the page below.
header('Location: http://www.google.com/');

// For more information check out the php manual
// http://www.php.net/header

?›




Meta Tag Refresh Redirect: You can also have an instant or delayed redirect using a meta tag in the tags of your webpage. Insert the following code into the head tags and change the URL as appropriate. Change the 0 to any number you want. The bigger the number the longer the delay will be before redirecting. To view an example click here.

‹META HTTP-EQUIV=REFRESH CONTENT="0; URL=http://www.google.com"›


 

100,00% of 2 voters found this FAQ useful,  I found this FAQ  useful useful  not useful not useful
< Prev
Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: Jumptags Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Blogmarks Add to: Technorati Add to: Newsvine Add to: Spurl Add to: Google Information
Social Bookmarking
Advertisement