Redirect a webpage to another page


We're going to show you how to make one page change into another after a certain amount of time.

This can be useful if the first page is under construction, and you don't want people to see it until it is finished.
You can simply redirect them from the first page to another page using the <meta http-equiv="refresh" > code on the first page, like this:
<meta http-equiv="refresh" content="0;url=secondpage.html">
When you go to the first page, it will redirect you to secondpage.html before you see the first page!


Let's make a page to go to called "underconstruction.html"

  1. create a new Text Document
  2. save it as "underconstruction.html"
  3. open it up in Notepad and add this code into it:
    <html>
     <head>
      <title>Under Construction</title>
     </head>
     <body>
      This page is under construction.
      <br>Please try later.
     </body>
    </html>
    
  4. save the code and open the page in a browser.
    you'll see this:
    This page is under construction.
    Please try later.
  5. open the code for the page you want to redirect people from, and add this:
    <html>
     <head>
      <title>My Web Page</title>
      <meta http-equiv="refresh" 
      content="0;
      url=underconstruction.html">
     </head>
    
  6. save the code and open the page in a browser
    you will be directed to underconstruction.html!
You can change the page after url= to any page in your site or on the Internet.
Let's change it to Google:
  1. open the code for the first page and change it to this:
      <title>My Web Page</title>
      <meta http-equiv="refresh"
      content="0;
      url=http://www.google.com">
     </head>
    

    (remember to put in the http:// before a web page name on the Internet)
  2. save the code and open the page in a browser
    you will now be directed to Google
You can change the number of seconds it takes for the page to redirect by changing the number 0 in content="0; to another number.
Let's make the page redirect after 3 seconds:
  1. open the code for the first page and change it to this:
      <title>My Web Page</title>
      <meta http-equiv="refresh" 
      content="3;
      url=http://www.google.com">
     </head>
    
  2. save the code and open the page in a browser
    you will now be directed to Google after 3 seconds.
    Make sure you wait for 3 seconds!

more tutorials to try


you might like to try these tutorials too:


Warning: include(likeEnd.html) [function.include]: failed to open stream: No such file or directory in E:\Domains\g\go-berserk.com\user\htdocs\metaRefresh.php on line 146

Warning: include() [function.include]: Failed opening 'likeEnd.html' for inclusion (include_path='.;C:\PHP-5.2.17\pear') in E:\Domains\g\go-berserk.com\user\htdocs\metaRefresh.php on line 146

Go Berserk Book

Buy Now to buy for
£11.99 US$17.99 €13.99 (not incl. P&P)
for 1 or 2 books
Buy more and save!
Email sales@go-berserk.com
for 3 books or more.



Go Berserk CSS Book

Buy Now to buy for a special price of
£8.99 US$13.99 €11.99 (not incl. P&P)
for 1 or 2 books
Buy more and save!
Email sales@go-berserk.com
for 3 books or more.