PHP Redirect

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:

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

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,

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

* JavaScript Redirects

setTimeout("location.href='[some-url]'", [time]);

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.

About the Author
Sanjib Ahmad, Freelance Writer and Product Consultant for http://www.marc8.com.

You are free to use this article in its entirety as long as you leave all links in place, do not modify the content, and include the resource box listed above.

In The News:


pen paper and inkwell


cat break through


How Web Templates Are Helping Online Businesses to MultiplyTheir Income

Web templates by nature are created to aid and ease... Read More

Growing Your Meetings In CyberSpace

As increasing numbers of people search for information on the... Read More

Websites: You Get What You Pay For!

So you finally decided to invest in a web presence... Read More

The Secret Benefit Of Accessibility: Part 1 - Increased Usability

Web accessibility has so many benefits that I really do... Read More

Getting a Web Site Can Be Fast, Easy, and Inexpensive When You Know Your Options

So what do you do if need to get a... Read More

Search Engines and Customers Want Focused Web Site Content

How do you decide on the content, products and or... Read More

7 Reasons YOU Need a Website

1) A marketing necessityI still hear it said from time... Read More

Eight Deadly Web Site Mistakes and How to Avoid Them

Creating and maintaining an effective presence on the Web has... Read More

Creating a Sticky Web Site

When used to describe a web site, the term "sticky"... Read More

From Search to Sale

The Internet car buyer is an elusive animal. Trying to... Read More

The Two Most Common Mistakes That Scare Away Web Visitors

Can you imagine the hypocrisy of spending thousands of dollars,... Read More

Content Management ? The New Standard in Web Design

The evolution of web development parallels the model of technology... Read More

You Don?t Have to be Amazon.com to Achieve 12% Conversion Rates!

That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More

Why Your Brick-and-Mortar Biz Needs A Website

The internet has taken over our lives with a vengeance,... Read More

Do You And Your Website Have Credibility?

I recently received an unsolicited e-mail from some company offering... Read More

7 Profit Producing Reasons Why Every Successful Service Professional Needs A Web Presence

Your business website is a critical aspect of being able... Read More

Web Accessibility: The Basics

What is web accessibility & why is it important?Web accessibility... Read More

What Business Owners MUST Know BEFORE They Commit To Having A Web Site

Q1.Why would I need a web site? A1.- Improve my... Read More

Nonsense! Why Do I Need a Website?

"I don't sell anything online, I don't advertise online, in... Read More

5 Ways to Build a Website

If you are like me you have wanted to build... Read More

How To Get Your Customers To Trust Your Website

Research reveals three important facts:1) The Internet is one of... Read More

Website Imperatives and Solutions

When you take a look at the most visited sites... Read More

9 Keys to an Effective Website

Many small companies choose not to invest in a professionally... Read More

Web Site Optimization: How To Speed Up Your Web Site By Minimizing Your GIF and PNG Image Bit-Depth

Are bloated images slowing down your web site and causing... Read More

Web Site Promotion: How To Advertise Your Website For Profits

Making money with your web site is the dream and... Read More

Improve Web Sales Figures Forever And Ever Amen!

"How do I improve web site sales figures?" The CEO... Read More

How to Make Your Own Free Website in 8.5 Minutes or Less

Designing and creating your own website does not have to... Read More

The Cost Of A Web Site

Just starting out, you can start with a simple informational... Read More

Up The Sandbox!

Go to any internet marketing forum you want these days... Read More

Web accessibility for screen magnifier users

The needs of screen magnifier users are overlooked when implementing... Read More

Content Management

More and more businesses are recognizing the importance of content... Read More

Optimal Website Design

Optimal website design is the art of logical navigation.It will... Read More

Setting Up Your First Website

Q. Hey, Cathy: I'm just setting up a website. What... Read More