articleandcontent.com articleandcontent.com
Site Home About Us Security & Privacy ToS Place Your Link Submit Article
Search:   
Add Url
 

Art & Creative

Online & Indoor Games

Fashion & Relationships

Research & Science

Automobiles

Computers & Software

News & Media

Shopping & Auction

Government & Politics

Healthcare & Treatment

Business & Services

Sports

People & Society

Recreation & Entertainment

Hygiene & Health

Teens & Children

Family & Home

Self Enhancement

Property & Agents

Education & Learning

Tour & Travel

Banking & Finance

Jobs & Employment

Drink & Food

 

Site Home › Computers & Software › Web Development Services
 

PHP Redirect

 
Author: Sanjib Ahmad

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's 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's 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.

Author Bio:

Sanjib Ahmad

Sanjib Ahmad is a chief executive, programmer, graphics designer, musician and an author. He is currently dwelving on a new area of expertise.

You can search for this article using: web site development, web design & development, website development tampa
 
 
 

Related Articles

 
Money Mule Email Scam Hits U.S.
 
Be Certifiable! The Basics of MCSE and MCP
 
Toshiba Wins Hollywood Support for the HD DVD format
 
All About Your Computer's BIOS
 
Heliodisplay --Computer Video With No Screen
 
Why Free Traffic From Articles Will Always Buy More From You Than Paid For PPC Traffic
 
Making your Website Memorable
 
Blog Host that Pays
 
The Most Important Principles for Internet Success
 
Six Reasons Why You Would Want to Make Money Online
 
 
 
 

Google AdSense Account Terminated - What Should You Do?

Once you have decided to take your marketing campaign to Google?s AdSense pay per click program, you ... - Casey Yew
 

Effective Communication for Webmasters

The primary aim of your website is to communicate. In order for webmasters to convey their thoughts ... - Gene DeFazzio
 

Getting Free Content For Your Site

learn how to get free contents for your website. You don't always have to pay writer to write conten ... - Verapol Chaiyapin
 
 

Keyword Density & SEO

Keyword density is an important factor in search engine optimization (SEO). Keywords, as the name in ... - Mike Francis
 

Internet Marketing for Loan Officers

If you are a loan officer or mortgage broker looking to keep your name, and your products and servic ... - Jay Conners
 

Money Mule Email Scam Hits U.S.

Job offer scam sent in email can lead to huge liability and legal troubles for honest people - Steve Freedman
 

Cisco Certification: The Importance Of Building Your Own Practice Lab

CCNA and CCNP candidates often hear that they need hands-on experience to excel on the exams. Chris ... - Chris Bryant
 

Website technologies on the Go!

Client Side and Servers Side are the two kinds of technologies used in web sites. The first type mea ... - Maricon Williams
 
 
Site Home -> Security & Privacy -> ToS  
© 2006-2008 www.articleandcontent.com All Rights Reserved Worldwide.