• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

PHP Redirect Tutorial ...

A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo.com in the browser automatically transfers the user to another URL bar.com.

A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo.com in the browser automatically transfers the user to another URL bar.com.

The PHP Redirect command

    <?php
    header("location: [some-url]");
    ?>

Replace [some-url] with the URL where you want the redirection to take place.

For example,

    header("location: ./version2/index.html"); =>redirect to "index.html" page in
    subfolder called "version2"
    header("location: http://www.yahoo.com"); =>redirect to a website called yahoo.com

If PHP is not available, it is also possible to use other redirects:

HTTP Redirects

    <meta http-equiv="Refresh" content="[time];
    URL=[some-url]">


Replace [time] with seconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.

For example,

    <meta http-equiv="Refresh" content="5;
    URL=http://www.yahoo.com">


The above HTTP based redirect needs to be in the region of the HTML code.

JavaScript Redirects


    <script language=javascript>
    setTimeout("location.href=[some-url]",[time]);
    </script>


Replace [time] with milliseconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.

For example,

    setTimeout("location.href=http://www.yahoo.com", 5000);

The above JavaScript based redirect can be either in the or region of the HTML code.
Usually a PHP redirect is much more reliable than other form of redirects like HTTP redirect or JavaScript based redirects. For example a JavaScript redirect may not work if a user is browser settings has JavaScript turned off.

The reason why PHP redirects will work no matter what settings users have on their browser is because PHP is server side script. It will not depend on browser settings that may affect JavaScript which is parsed on the client-side/user-side.

 View Full Story.
Posted at 08:57:52 am | Permalink | Posted in PHP  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Be the first ... |Add your comment.

Your Comment ...

  Name (required)

  Email (required, hidden)

  Website


Top Stuff

e-messenger

MessengerFX

eBuddy

ILoveIM

AIM Express

Top 20 Ruby CMS


Our Partners

Facebook Applications

Ajax Projects

Web 2.0 Sites

Webloglines

Human Development Handbook

Software Development Company

Ajaxlines

Stock Exchange Chat


About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (114)
  • Ajax (10)
  • Ajax Games (9)
  • Articles (94)
  • Bookmarking (35)
  • Calendar (19)
  • Chat (40)
  • ColdFusion (3)
  • CSS (48)
  • Email (23)
  • Facebook (41)
  • Flash (17)
  • Google (30)
  • Html (16)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (40)
  • Javascript (190)
  • jQuery (3)
  • JSON (24)
  • Perl (2)
  • PHP (97)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (1)
  • Ruby (15)
  • Storage (4)
  • Toolkits (94)
  • Tutorials (203)
  • UI (12)
  • Utilities (173)
  • Web2.0 (18)
  • XmlHttpRequest (22)
  • YUI (4)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange