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.
maid service near Lake Forest ..Is your website Really useful?I had a 'rep' in yesterday... Read More
cPanel is a control panel for your website and allows... Read More
You've put up a website to promote a product or... Read More
Most interactive websites nowadays require data to be presented dynamically... Read More
Often time I've browsed sites and seen the same thing... Read More
First, using a lot of web graphics, flash, banners and... Read More
We are clearly well past the innocent "golden age" of... Read More
Dynamically Update Your Web Pages Via E-MailIf you can Send... Read More
When most people build a web site, they think one... Read More
Building a new website can be a lengthy task. From... Read More
With all of the factors involved in designing and building... Read More
One of my most salient memories from when I sold... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
How popular is online shopping? And is there room for... Read More
Can you imagine the hypocrisy of spending thousands of dollars,... Read More
Project Safekids provides webmasters a valuable tool which could save... Read More
Making a web site is easy. Making a good web... Read More
What is the point of having a website, you may... Read More
When used to describe a web site, the term "sticky"... Read More
When web content gets discussed on webmaster bulletin boards, the... Read More
They might not be wearing a mask and carrying a... Read More
In this day and age most businesses consider having their... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
So you've decided to start an online work at home... Read More
Globalize Your WebsiteThe Internet has unlocked a wide array of... Read More
top rated cleaning service Des Plaines ..Are you, like many other website owners, frustrated at the... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
In this day and age most businesses consider having their... Read More
Let's begin by setting some limits. If you're like me,... Read More
Globalize Your WebsiteThe Internet has unlocked a wide array of... Read More
Your business website is a critical aspect of being able... Read More
If you like the Internet and surfing through the billions... Read More
There's been widespread speculation about the new legislation being introduced... Read More
Optimal website design is the art of logical navigation.It will... Read More
"What's in it for me?" you ask. "Why should I... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
How popular is online shopping? And is there room for... Read More
Better Web Site ROIHow to increase your business profitability by... Read More
There was a time not long ago when setting up... Read More
Mini Websites are the most powerful and cost effective solution... Read More
When building a relationship, listening is more important than talking.A... Read More
Cost Effective Advertising. Online selling. Increased geopgraphic range. Wider... Read More
Have you ever wondered what challenges are faced by other... Read More
I recently received an unsolicited e-mail from some company offering... Read More
You want to give your site's visitors a way to... Read More
Now that you have got your domain name registered, your... Read More
I recently helped my mom to launch a website (www.mom2me.com)... Read More
The "robots" meta tag, when used properly, will tell the... Read More
Revenues are often lost because many business owners don't see... Read More
Web Development |